How to use the Eigen unsupported levenberg marquardt implementation?

后端 未结 4 482
说谎
说谎 2020-12-24 04:29

I\'m trying to minimize a following sample function:

F(x) = f[0]^2(x[0],...,x[n-1]) + ... + f[m-1]^2(x[0],...,x[n-1])

A normal way to minim

4条回答
  •  Happy的楠姐
    2020-12-24 05:01

    It seems that the function is more general:

    1. Let's say you have an m parameter model.
    2. You have n observations to which you want to fit the m-parameter model in a least-squares sense.
    3. The Jacobian, if provided, will be n times m.

    You will need to supply n error values in the fvec. Also, there is no need to square the f-values because it is implicitly assumed that the overall error function is made up of the sum of squares of the fvec components.

    So, if you follow these guidelines and change the code to:

    fvec(0) = sqrt(10.0)*(x(0)+3.0);
    fvec(1) = x(1)-5.0;
    

    It will converge in a ridiculously small number of iterations - like less than 5. I also tried it on a more complex example - the Hahn1 benchmark at http://www.itl.nist.gov/div898/strd/nls/data/hahn1.shtml with m=7 parameters and n=236 observations and it converges to the known right solution in only 11 iterations with the numerically computed Jacobian.

提交回复
热议问题