-
-
Notifications
You must be signed in to change notification settings - Fork 188
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
Hessian NaN with ordered_logistic_lpmf #3016
Comments
I've traced this down to the reverse specialization of These appear to be created on line 144 of Here is a test which could be added to show this: TEST(mathMixScalFun, ordered_logistic_lpmf) {
auto f = [](const auto y) {
return [=](const auto& lambda, const auto& cutpoints) {
return stan::math::ordered_logistic_lpmf(y, lambda, cutpoints);
};
};
int y = 3;
double mu;
Eigen::Matrix<double, -1, 1> c(2, 1);
c << -1, 1;
stan::test::expect_ad(f(y), mu, c);
} |
For the same case, Hessian works in BridgeStan. What is the difference to CmdStanR? |
BridgeStan defaults to using finite differences since that would be available for all models. If you opt into AD Hessians at compile time you should see the same NaNs |
Thanks. I missed |
I'm testing this via CmdStanR
$hessian()
method, but I guess the problem is in math.$hessian()
method works for the following Stan model if datay=2
but gives NaN ify=3
.$laplace()
method is able to compute finite Hessian (finite difference?), so the reason is not that Hessian would not exist (gradient is also close to 0, so the Hessian is computed (near) the mode).R code to reproduce
The text was updated successfully, but these errors were encountered: