possible to reduce the relative difference for CheckGradients in optimization (fmincon)?

16 vues (au cours des 30 derniers jours)
SA-W le 26 Oct 2022
Commenté : SA-W le 17 Jan 2023
When double-checking my Jacobian using CheckGradients, I have a relative maximum difference of, crudely, 4e-6,
and my entries of the Jacobian are in the ballpark 1e-1.
I do not expect that Finite Difference can calculate the first six digits after the decimal correctly as my problem has large second derivatives.
That said, can I reduce the relative difference in CheckGradients from 1e-6 to a different value?
0 commentairesAfficher -1 commentaires plus anciensMasquer -1 commentaires plus anciens

Connectez-vous pour commenter.

Réponse acceptée

Matt J le 26 Oct 2022
Modifié(e) : Matt J le 27 Oct 2022
This FEX download allows you to obtain the results of the finite differencing, as well as to decide where (at what x) you want it computed,
Occasionally also, I find it to be more accurate and reliable as a checking tool than CheckGradient.
In any case, because it gives you the computed FD gradient, you can use this tool to compare both the finite difference and analytical gradients according to whatever error criterion that you wish.
1 commentaireAfficher AucuneMasquer Aucune
SA-W le 27 Oct 2022
Thank you, I will check that reference out!

Connectez-vous pour commenter.

Plus de réponses (1)

Torsten le 26 Oct 2022
Modifié(e) : Torsten le 26 Oct 2022
Why not just turning off the CheckGradient feature if you are sure your derivatives are correct within a certain error tolerance (which might be larger than 1e-6) ?
5 commentairesAfficher 4 commentaires plus anciensMasquer 4 commentaires plus anciens
SA-W le 17 Jan 2023
Let me asked one more question regarding your last comment (if you still get notifications about that chat. If not, I will create a new chat).
What you described in your last comment is exactly what is also stated in the documentation.
This would mean that GradientCheck works, although gradient_USER(1) is, clearly, wrong. Is that true?

Connectez-vous pour commenter.

Catégories

En savoir plus sur Programming dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by