Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(stess)test derivatives #42

Open
tpapp opened this issue Apr 9, 2019 · 2 comments
Open

(stess)test derivatives #42

tpapp opened this issue Apr 9, 2019 · 2 comments

Comments

@tpapp
Copy link
Owner

tpapp commented Apr 9, 2019

DynamicHMC does not deal well with incorrect deriatives. These can result from AD errors (conceptual errors in mature AD libraries are rare, but numerical corner cases can still happen), or bugs in manually coded derivatives.

There should be functionality to test for these things. Ideally independently of AD, eg with finite differences, possibly using Richardson extrapolation (is there a package for that?).

Decisions to make: should this be part of stresstest, or something else?

@chriselrod
Copy link

I do think this would be useful.

The problem I had in the other issue was resolved, and the result of misspecified analytical gradients/Jacobian which was used by AD.
The bias was subtle, because it was in the log determinant contribution of a variance parameter in a matrix normal distribution. This can be swamped by the quadratic form when far from the posterior mode (eg, as when just evaluating it at randn(dimension(ℓ))).

Calculus.jl already has a check_gradient function. While check_gradient doesn't use it, they also have taylor finite difference, which looks worth considering.

@tpapp
Copy link
Owner Author

tpapp commented Dec 15, 2023

I find https://github.com/JuliaDiff/FiniteDifferences.jl excellent for calculating derivatives (explicitly avoiding AD, because very often that's what I want to test), so we could support that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants