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

Obtain Fisher Information/Hessian of my model's log probability function? #641

Closed
AidanMar opened this issue Nov 22, 2022 · 2 comments
Closed

Comments

@AidanMar
Copy link

Summary:

I'd like to compute the Fisher Information of my posterior, to obtain the quadratic approximation of my model. I need the hessian to do this, but can't seem to get it with cmdstanpy

Description:

I can't find anywhere in the docs how you can extract this throught the cmdstan interface. However, this functionality is available through the rstan. You simply put hessian=TRUE. cmdstanpy doesn't appear to have an equivalent way of doing this that I can see after perusing the source (maybe I missed it? Please enlighten if so). If it's not currently available, is there any simple work around to extracting this with cmdstanpy?

Current Version:

cmdstan: (2, 30)
cmdstanpy: 1.0.8

@WardBrian
Copy link
Member

There is no way to get this information from a CmdStan model currently. The next version of CmdStan (2.31) and CmdStanPy (1.1) will support the ability to calculate a gradient (#637), and you could numerically differentiate that function if desired. This is equivalent to what RStan does, but the overhead will be higher.

Alternatively, more developer focused tools like BridgeStan may be interesting to you. Currently this will also just be finite differences for the Hessian (though with significantly lower overhead), but in the future it will suport nested autodiff for many models

@WardBrian WardBrian closed this as not planned Won't fix, can't repro, duplicate, stale Nov 22, 2022
@bob-carpenter
Copy link
Member

Given that we only produce gradients for the input values, it'd be a real pain to use CmdStan to calculate Hessians by finite differences over the gradients as that requires an epsilon offset on each dimension of the input.

BridgeStan is definitely the way to go for this. BridgeStan uses central finite diffs for more accuracy, but it's even more evaluations.

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

3 participants