commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Benjamin Eltzner <>
Subject [math3.fitting.leastsquares]
Date Fri, 01 Aug 2014 16:29:33 GMT
Dear mailing list,

I would like to do a Levenberg-Marquardt least mean square fit (i. e.
min( |f(x)|^2 ) for f: R^d -> R^n, d in [2,8], n in [~50, ~10000]) using
org.apache.commons.math3.fitting.leastsquares.LevenbergMarquardtOptimizer and
I am somewhat confused by the relevant API.

tl/dr: Is there a way to do this in a simple way, providing only a
function f, its derivative function df and an initial guess for x?

Long form: it seems that I have to create a LeastSquaresProblem which
requires a lot of input

* MultivariateVectorFunction model: done
* MultivariateMatrixFunction jacobian: done
* double[] observed: [0,...,0] in my case, since i want least mean
squares, right?
* double[] start: done
* RealMatrix weight: should this be a "new DiagonalMatrix([1,...,1])" of
the dimension of "observed"?
* ConvergenceChecker<LeastSquaresProblem.Evaluation> checker: no clue
* int maxEvaluations: no clue
* int maxIterations: no clue

Is there a way to get "reasonable defaults" for the three or four last
arguments? Or put differently, what would be "typical" inputs for the
last four arguments?

I would be very glad, if you could help me with this problem. I have
been trying to figure out, what would be sensible inputs be reading the
source code, but I guess it would take ages until I really understood
what is going on there. The results of a trial-and-error approach have
also been rather disappointing so far.

Best regards,

Benjamin Eltzner

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message