Borrar filtros
Borrar filtros

Check of the gradient of the negative log-likelihood

3 visualizaciones (últimos 30 días)
boureghda mohammed
boureghda mohammed el 14 de En. de 2017
Editada: Matt J el 16 de En. de 2017
To verify the the supplied gradient of the negative log-likelihood calculated by using Gaussian filtering (differentiated Uuscented Kalman Filter) I used the DerivativeCheck from Matlab by:
Opt =optimset('DerivativeCheck','on','GradObj','on','Display','iter',,'Algorithm','sqp','FinDiffType','central');
problem = createOptimProblem('fmincon','objective',@neg_logLik,'x0',th0,'lb',LB,'ub',UB,'options',Opt);
I get the following message:
Objective function derivatives:
Maximum relative discrepancy between derivatives = 0.9
Caution: user-supplied and central finite-difference derivatives do
not match within 1e-006 relative tolerance.
To displaying full derivativecheck output, I used the following code:
To displaying full 'DerivativeCheck' output, I used the following code:
[x,fval,exitflag,output,lambda,grad]=fmincon(...)
From https://www.mathworks.com/matlabcentral/answers/46854-displaying-full-derivativecheck-output.
I did this with MaxIter = 0 and GradObj = 'off'. the output grad will be fmincon's idea of the gradient of −L(θ) calculated by finite difference at the initial point and I get the following results:
My supplied derivatives results:
-120.5610
42.5878
-28.1507
9.7675
and finite difference results:
-12.0561
4.2588
-2.8151
0.9767
My results and the results of the finite difference look the same but my results multiplied by 10. What's wrong?

Respuestas (1)

Matt J
Matt J el 14 de En. de 2017
Editada: Matt J el 16 de En. de 2017
My results and the results of the finite difference look the same but my results multiplied by 10. What's wrong?
Isn't it obvious? Your gradient computation is off by a factor of 10.

Community Treasure Hunt

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

Start Hunting!

Translated by