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

Update metropolis.py #6825

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions pymc/step_methods/metropolis.py
Original file line number Diff line number Diff line change
Expand Up @@ -758,8 +758,13 @@

if proposal_dist is not None:
self.proposal_dist = proposal_dist(S)
else:
elif S.ndim == 1:
self.proposal_dist = NormalProposal(S)
elif S.ndim == 2:
self.proposal_dist = MultivariateNormalProposal(S)

Check warning on line 764 in pymc/step_methods/metropolis.py

View check run for this annotation

Codecov / codecov/patch

pymc/step_methods/metropolis.py#L763-L764

Added lines #L763 - L764 were not covered by tests
else:
raise ValueError("Invalid rank for variance: %s" % S.ndim)

Check warning on line 766 in pymc/step_methods/metropolis.py

View check run for this annotation

Codecov / codecov/patch

pymc/step_methods/metropolis.py#L766

Added line #L766 was not covered by tests


self.scaling = np.atleast_1d(scaling).astype("d")
if lamb is None:
Expand Down Expand Up @@ -902,8 +907,12 @@

if proposal_dist is not None:
self.proposal_dist = proposal_dist(S)
else:
elif S.ndim == 1:
self.proposal_dist = NormalProposal(S)
elif S.ndim == 2:
self.proposal_dist = MultivariateNormalProposal(S)

Check warning on line 913 in pymc/step_methods/metropolis.py

View check run for this annotation

Codecov / codecov/patch

pymc/step_methods/metropolis.py#L912-L913

Added lines #L912 - L913 were not covered by tests
else:
raise ValueError("Invalid rank for variance: %s" % S.ndim)

Check warning on line 915 in pymc/step_methods/metropolis.py

View check run for this annotation

Codecov / codecov/patch

pymc/step_methods/metropolis.py#L915

Added line #L915 was not covered by tests

self.scaling = np.atleast_1d(scaling).astype("d")
if lamb is None:
Expand Down
Loading