Skip to content

Fix bug in fit_laplace when model has exactly one variable#437

Merged
fonnesbeck merged 1 commit intopymc-devs:mainfrom
jessegrabowski:laplace-bug
Mar 21, 2025
Merged

Fix bug in fit_laplace when model has exactly one variable#437
fonnesbeck merged 1 commit intopymc-devs:mainfrom
jessegrabowski:laplace-bug

Conversation

@jessegrabowski
Copy link
Copy Markdown
Member

When a mean vector has exactly one element, scipy.stats.multivariate_normal.rvs squeezes the leading dimension, which was causing errors in fit_laplace for models with exactly one parameter.

This PR patches the behavior by adding a check for this corner case.

@jessegrabowski jessegrabowski added the bug Something isn't working label Mar 21, 2025
Copy link
Copy Markdown
Member

@fonnesbeck fonnesbeck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@fonnesbeck fonnesbeck merged commit 7d62c53 into pymc-devs:main Mar 21, 2025
5 checks passed
@ricardoV94
Copy link
Copy Markdown
Member

Why not use the numpy one that doesn't have that stupid squeeze behavior?

velochy pushed a commit to velochy/pymc-extras that referenced this pull request Feb 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants