You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using the NonlinearObjectiveModel for nonlinear least squares fitting of weighted data. However, the fitting fails due to an overflow exception when the number of data points becomes too large (let's say, 10000+).
The origin of this exception is the SetObserved method in the NonlinearObjectiveFunction. At the end of this method, a DenseMatrix is constructed for the data point weights, although this matrix contains diagonal elements only. The dense matrix stores all (10000+)^2 (mostly zero) entries, which exceeds my memory. To my mind, a DiagonalMatrix would be the better choice here.
... and it solves my issue. I also tested this for small data (10 points) and didn't notice any performance declines there either.
Is there any reason for hanging on to the DenseMatrix? If not, I would suggest modifying the mentioned lines as described. I'm happy to great a pull request for this.
The text was updated successfully, but these errors were encountered:
@diluculo That's true, I didn't follow it further. Storing L should be sufficient, since the Weights apparently aren't used otherwise. I could imagine that keeping them was a "consistency choice"?!
How should we proceed? Should I implement the (minor) changes and create a pull request? If so, would you suggest removing the Weights property from the class?
@laidBackBird, the 'Weights' is not only set initially but can be changed at each iteration step in some cases. That is, it needs to be verified later. It is why I made 'Weights' public property.
I'm using the
NonlinearObjectiveModel
for nonlinear least squares fitting of weighted data. However, the fitting fails due to an overflow exception when the number of data points becomes too large (let's say, 10000+).The origin of this exception is the
SetObserved
method in theNonlinearObjectiveFunction
. At the end of this method, aDenseMatrix
is constructed for the data point weights, although this matrix contains diagonal elements only. The dense matrix stores all (10000+)^2 (mostly zero) entries, which exceeds my memory. To my mind, aDiagonalMatrix
would be the better choice here.I've tested replacing line 217-219 with
... and it solves my issue. I also tested this for small data (10 points) and didn't notice any performance declines there either.
Is there any reason for hanging on to the
DenseMatrix
? If not, I would suggest modifying the mentioned lines as described. I'm happy to great a pull request for this.The text was updated successfully, but these errors were encountered: