LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Levenberg-Marquardt fit tweaks

Solved!
Go to solution

Hi,

 

I have two questions concerning the Nonlinear Curve fit LM VI:

 

1) Does anybody know why after a successful iteration the value for lambda is multiplied by 0.4 instead of 0.1 as in standard implementation (i.e. Numerical Recipes)? Does this factor have a big influence on the speed of the fit?

 

2) Is there a way to use analytical derivatives to speed up the evaluation of the gradient and the hessian of chisquare?

 

 

Thanks,

Bernard

 

0 Kudos
Message 1 of 6
(3,114 Views)
Solution
Accepted by topic author bernaille

1) Perhaps it is so nobody accuses them of directly using the NR implementation without attribution.  That value is just an empirical guess, so there is nothing too magical about 0.1 or 0.4 (better be less than 1).  Since you have found where this value is used (not too hard), I suggest you do the experiment by changing it to 0.1 or 0.2 or 0.5 and see if it makes a difference.  Let me know, I  haven't tried it.  When I implemented the NR routine in LV I used 0.1 and it worked, and when I use the LV routine with 0.4 it still works.

 

2)  If you select f(x,a) is a VI to use a sub-VI to calculate the function values you can also return the analytic derivatives.  This can save time and reduce round-off error, and I whole-heartedly recommend it when feasible. 

Message 2 of 6
(3,095 Views)

hi

in a recent post, I asked how to pass the function for the LM fit -still didn't figured it out- how to paste a f(a,x) function to the subvi

N

0 Kudos
Message 3 of 6
(3,081 Views)

 


nitad54448 wrote:

hi

in a recent post, I asked how to pass the function for the LM fit -still didn't figured it out- how to paste a f(a,x) function to the subvi

N


 

 

Missed that one, I have tried to help you out in your original thread.

Message 4 of 6
(3,075 Views)

thanks, I will look into it.

regards

N

0 Kudos
Message 5 of 6
(3,042 Views)

Thanks Darin for the excellent suggestions. 

 

I tried to change the decreasing factor of lambda to 0.1 but I couldn't notice a difference.

 

However, the use of analytical derivatives improved the performance by at least 30% !

 

It took me some time to understand how to do it properly and found valuable hints in this post:

 

http://forums.ni.com/ni/board/message?board.id=170&message.id=405264&query.id=418412#M405264 

0 Kudos
Message 6 of 6
(3,020 Views)