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

Bug fix of PyMC3 model that contains Potential #1043

Merged
merged 2 commits into from
Feb 4, 2020
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions arviz/data/io_pymc3.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,7 @@ def is_data(name, var) -> bool:
var not in self.model.deterministics
and var not in self.model.observed_RVs
and var not in self.model.free_RVs
and var not in self.model.potentials
and (self.observations is None or name not in self.observations)
)

Expand Down
9 changes: 9 additions & 0 deletions arviz/tests/test_data_pymc.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,15 @@ def test_single_observation(self):
inference_data = from_pymc3(trace=trace)
assert inference_data

def test_potential(self):
with pm.Model():
x = pm.Normal("x", 0.0, 1.0)
pm.Potential("z", pm.Normal.dist(x, 1.0).logp(np.random.randn(10)))
trace = pm.sample(100, chains=2)

inference_data = from_pymc3(trace=trace)
assert inference_data

def test_constant_data(self):
with pm.Model():
x = pm.Data("x", [1.0, 2.0, 3.0])
Expand Down