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

use inference data in end of sampling report #3883

Merged
merged 2 commits into from
Apr 20, 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
2 changes: 2 additions & 0 deletions RELEASE-NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
- Dropped the outdated 'nuts' initialization method for `pm.sample` (see [#3863](https://github.com/pymc-devs/pymc3/pull/3863)).
- Moved argument division out of `NegativeBinomial` `random` method. Fixes [#3864](https://github.com/pymc-devs/pymc3/issues/3864) in the style of [#3509](https://github.com/pymc-devs/pymc3/pull/3509).
- The Dirichlet distribution now raises a ValueError when it's initialized with <= 0 values (see [#3853](https://github.com/pymc-devs/pymc3/pull/3853)).
- End of sampling report now uses `arviz.InferenceData` internally and avoids storing
pointwise log likelihood (see [#3883](https://github.com/pymc-devs/pymc3/pull/3883))

## PyMC3 3.8 (November 29 2019)

Expand Down
8 changes: 5 additions & 3 deletions pymc3/backends/report.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def n_draws(self) -> typing.Optional[int]:
def t_sampling(self) -> typing.Optional[float]:
"""
Number of seconds that the sampling procedure took.

(Includes parallelization overhead.)
"""
return self._t_sampling
Expand All @@ -108,6 +108,7 @@ def _run_convergence_checks(self, trace, model):
return

from pymc3 import rhat, ess
from arviz import from_pymc3

valid_name = [rv.name for rv in model.free_RVs + model.deterministics]
varnames = []
Expand All @@ -119,8 +120,9 @@ def _run_convergence_checks(self, trace, model):
if rv_name in trace.varnames:
varnames.append(rv_name)

self._ess = ess = ess(trace, var_names=varnames)
self._rhat = rhat = rhat(trace, var_names=varnames)
idata = from_pymc3(trace, log_likelihood=False)
self._ess = ess = ess(idata, var_names=varnames)
self._rhat = rhat = rhat(idata, var_names=varnames)

warnings = []
rhat_max = max(val.max() for val in rhat.values())
Expand Down
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
arviz>=0.4.1
arviz>=0.7.0
theano>=1.0.4
numpy>=1.13.0
scipy>=0.18.1
Expand All @@ -7,4 +7,4 @@ patsy>=0.5.1
fastprogress>=0.2.0
h5py>=2.7.0
typing-extensions>=3.7.4
contextvars; python_version < '3.7'
contextvars; python_version < '3.7'