-
-
Notifications
You must be signed in to change notification settings - Fork 50
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
Laplace approximation not handling non-scalar parameters #376
Comments
I can confirm this is a bug. The code assumes all parameters to be scalars in multiple places. First this line would fail with 2d parameters:
Which should be instead Then in this loop we are assuming there is a single entry per variable (with chain, draws batch):
This later leads to the error reported above. Instead we should slice the portion corresponding to each variable, and reshape it to the original shape. There should be some utilities in the PyMC codebase to help with that. As a bonus we may want to recover the core dims, although I think the code would work without them. |
CC @carsten-j |
@ricardoV94 I will try to take at look at this sometime next week. |
@ricardoV94 I am not sure that I understand how to fix this bug. |
I think this can be fixed by the new code in #385 |
I have been trying to utilize the new
laplace
function for estimating the posterior distribution using a quadratic approximation. It seems that there is an issue when trying to use non-scalar parameters. This is a slight modification of the example that is provided in the documentation for the function:The following error is generated:
TypeError: ('Wrong number of dimensions: expected 1, got 0 with shape ().', 'Container name "mu"')
Interestingly, this error occurs even when the shape is not greater than 1 and no indexing is performed:
This seems to indicate that there is an issue with setting the shape parameter to any value.
The text was updated successfully, but these errors were encountered: