Check of the gradient of the negative log-likelihood
2 次查看(过去 30 天)
显示 更早的评论
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?
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!