Hi, I'm using the Levenberg-Marquandt algorithm to solve a non-linear equations system. Using fsolve() in debug mode, i follow step by step the matlab implementation, but I didn't find what I have expected. The implemented algorithm calculate the levenberg step with the following formula
AugJacobian=[Jacobian;diag(sqrt(lambda))]; AugResidual=[Residual;zeros];
step=AugJac \ AugRes;
In theory the Levenberg step is calculated with
step = (Hessian+diag(lambda)) \ (Jacobian'*Residual)
The results of the two formulas are different.
Why the implemented algorithm is not the one described in theory http://www.mathworks.it/it/help/optim/ug/least-squares-model-fitting-algorithms.html ?
or I'm missing something?

 채택된 답변

Matt J
Matt J 2014년 1월 28일
편집: Matt J 2014년 1월 28일

2 개 추천

Because of missing parentheses, I imagine
step = (Hessian+diag(lambda)) \ (Jacobian'*Residual)

댓글 수: 5

I'm sorry, probably I haven't explained well my problem. I like to know why in fsolve the lenveberg step is calculated with
AugJacobian=[Jacobian;diag(sqrt(lambda))]; AugResidual=[Residual;zeros];
step=AugJac \ AugRes;
and not with strictly the theoretical formula
step = (Hessian+diag(lambda)) \ (Jacobian'*Residual)
Matt J
Matt J 2014년 1월 28일
편집: Matt J 2014년 1월 28일
Theoretically, the two are equivalent (I assume you understand why), but numerically, the latter is not as well conditioned.
As an example, consider the following A*x=b system, the solution to which is x=[1;1]
>> A=[rand(2); eye(2)]; A(1)=1e6; b=sum(A,2);
Using the first solution approach you've shown above, we obtain a certain error
>> A\b - [1;1]
ans =
1.0e-15 *
0.2220
0
whereas the second approach is equivalent to the following, which yields much higher error
>> (A.'*A)\(A.'*b) - [1;1]
ans =
1.0e-10 *
-0.0000
0.8179
I think you have my solution :-) The problem is that I don't understand why the two are equivalent. The second approach that you have written is the Newton step evaluation
(A'*A)\(A'*b)
what i have expected for the levenberg is more like
((A'*A)+lambda*diag)\(A'*b)
the difference is that in the first the Hessian is approximated with first order terms so equal to J'J, and in the second the Hessian is approximated with an augmented diagonal term -> J'J + lambda*diag .
Thanks in advance for the help
Matt J
Matt J 2014년 1월 29일
편집: Matt J 2014년 1월 29일
When A has the form [J; c*D] where D is diagonal, and b has the form [r;zeros] then
(A.'*A) = J.'*J + c^2*D^2
and
A.'*b= J.'*r
Thus, (A'*A)\(A'*b) reduces exactly to the expression you're looking for with c^2=lambda and D^2=diag.
RiccardoTisseur
RiccardoTisseur 2014년 1월 29일
thank you very much for the help

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

질문:

2014년 1월 28일

댓글:

2014년 1월 29일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by