From 9b697f641cc65da6d5e4443020bb16619c759d9b Mon Sep 17 00:00:00 2001 From: "Oriol (ZBook)" Date: Sat, 18 Apr 2020 21:22:53 +0200 Subject: [PATCH 1/2] use from_pymc3(..., log_likelihood=False) and update requirements --- pymc3/backends/report.py | 8 +++++--- requirements.txt | 4 ++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/pymc3/backends/report.py b/pymc3/backends/report.py index d632490b23d..9a3ea6f636f 100644 --- a/pymc3/backends/report.py +++ b/pymc3/backends/report.py @@ -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 @@ -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 = [] @@ -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()) diff --git a/requirements.txt b/requirements.txt index fe546e34da3..4b10495e21a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -arviz>=0.4.1 +arviz>=0.7.0 theano>=1.0.4 numpy>=1.13.0 scipy>=0.18.1 @@ -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' From ecb70a630c23379aefd73c335b76ff030c49876f Mon Sep 17 00:00:00 2001 From: "Oriol (ZBook)" Date: Sun, 19 Apr 2020 14:21:18 +0200 Subject: [PATCH 2/2] update release notes --- RELEASE-NOTES.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index 0fb8bcb829e..2c2abe1eb38 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -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)