Skip to content

Commit d59a6e8

Browse files
Remove deprecated stuff (#3906)
* remove file which is not used * remove deprecated code * repair tests and notebooks that used deprecated API * mention #3906 Co-authored-by: Michael Osthege <[email protected]>
1 parent cc45303 commit d59a6e8

10 files changed

+11
-71
lines changed

.readthedocs.yml

-14
This file was deleted.

RELEASE-NOTES.md

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
- Deprecated `sd` in version 3.7 has been replaced by `sigma` now raises `DepreciationWarning` on using `sd` in continuous, mixed and timeseries distributions. (see #3837 and #3688).
2222
- In named models, `pm.Data` objects now get model-relative names (see [#3843](https://github.com/pymc-devs/pymc3/pull/3843)).
2323
- `pm.sample` now takes 1000 draws and 1000 tuning samples by default, instead of 500 previously (see [#3855](https://github.com/pymc-devs/pymc3/pull/3855)).
24+
- Dropped some deprecated kwargs and functions (see [#3906](https://github.com/pymc-devs/pymc3/pull/3906))
2425
- Dropped the outdated 'nuts' initialization method for `pm.sample` (see [#3863](https://github.com/pymc-devs/pymc3/pull/3863)).
2526
- 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).
2627
- The Dirichlet distribution now raises a ValueError when it's initialized with <= 0 values (see [#3853](https://github.com/pymc-devs/pymc3/pull/3853)).

docs/source/notebooks/api_quickstart.ipynb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1284,7 +1284,7 @@
12841284
}
12851285
],
12861286
"source": [
1287-
"pm.gelman_rubin(trace)"
1287+
"pm.rhat(trace)"
12881288
]
12891289
},
12901290
{

docs/source/notebooks/bayes_param_survival_pymc3.ipynb

+3-3
Original file line numberDiff line numberDiff line change
@@ -594,7 +594,7 @@
594594
}
595595
],
596596
"source": [
597-
"max(np.max(gr_stats) for gr_stats in pm.gelman_rubin(weibull_trace).values())"
597+
"max(np.max(gr_stats) for gr_stats in pm.rhat(weibull_trace).values())"
598598
]
599599
},
600600
{
@@ -904,7 +904,7 @@
904904
}
905905
],
906906
"source": [
907-
"max(np.max(gr_stats) for gr_stats in pm.gelman_rubin(log_logistic_trace).values())"
907+
"max(np.max(gr_stats) for gr_stats in pm.rhat(log_logistic_trace).values())"
908908
]
909909
},
910910
{
@@ -1030,4 +1030,4 @@
10301030
},
10311031
"nbformat": 4,
10321032
"nbformat_minor": 2
1033-
}
1033+
}

docs/source/notebooks/rugby_analytics.ipynb

+2-2
Original file line numberDiff line numberDiff line change
@@ -801,7 +801,7 @@
801801
"outputs": [],
802802
"source": [
803803
"bfmi = np.max(pm.stats.bfmi(trace))\n",
804-
"max_gr = max(np.max(gr_stats) for gr_stats in pm.stats.gelman_rubin(trace).values()).values"
804+
"max_gr = max(np.max(gr_stats) for gr_stats in pm.stats.rhat(trace).values()).values"
805805
]
806806
},
807807
{
@@ -1470,4 +1470,4 @@
14701470
},
14711471
"nbformat": 4,
14721472
"nbformat_minor": 4
1473-
}
1473+
}

pymc3/examples/samplers_mvnormal.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def run(steppers, p):
5252
runtimes[name] = time.time() - t_start
5353
print('{} samples across {} chains'.format(len(mt) * mt.nchains, mt.nchains))
5454
traces[name] = mt
55-
en = pm.diagnostics.effective_n(mt)
55+
en = pm.ess(mt)
5656
print('effective: {}\r\n'.format(en))
5757
if USE_XY:
5858
effn[name] = np.mean(en['x']) / len(mt) / mt.nchains

pymc3/sampling.py

-32
Original file line numberDiff line numberDiff line change
@@ -368,36 +368,9 @@ def sample(
368368
"""
369369
model = modelcontext(model)
370370

371-
nuts_kwargs = kwargs.pop("nuts_kwargs", None)
372-
if nuts_kwargs is not None:
373-
warnings.warn(
374-
"The nuts_kwargs argument has been deprecated. Pass step "
375-
"method arguments directly to sample instead",
376-
DeprecationWarning,
377-
)
378-
kwargs.update(nuts_kwargs)
379-
step_kwargs = kwargs.pop("step_kwargs", None)
380-
if step_kwargs is not None:
381-
warnings.warn(
382-
"The step_kwargs argument has been deprecated. Pass step "
383-
"method arguments directly to sample instead",
384-
DeprecationWarning,
385-
)
386-
kwargs.update(step_kwargs)
387-
388371
if cores is None:
389372
cores = min(4, _cpu_count())
390373

391-
if "njobs" in kwargs:
392-
cores = kwargs["njobs"]
393-
warnings.warn(
394-
"The njobs argument has been deprecated. Use cores instead.", DeprecationWarning
395-
)
396-
if "nchains" in kwargs:
397-
chains = kwargs["nchains"]
398-
warnings.warn(
399-
"The nchains argument has been deprecated. Use chains instead.", DeprecationWarning
400-
)
401374
if chains is None:
402375
chains = max(2, cores)
403376
if isinstance(start, dict):
@@ -412,11 +385,6 @@ def sample(
412385
random_seed = [np.random.randint(2 ** 30) for _ in range(chains)]
413386
if not isinstance(random_seed, Iterable):
414387
raise TypeError("Invalid value for `random_seed`. Must be tuple, list or int")
415-
if "chain" in kwargs:
416-
chain_idx = kwargs["chain"]
417-
warnings.warn(
418-
"The chain argument has been deprecated. Use chain_idx instead.", DeprecationWarning
419-
)
420388

421389
if start is not None:
422390
for start_vals in start:

pymc3/stats/__init__.py

-15
Original file line numberDiff line numberDiff line change
@@ -53,19 +53,6 @@ def wrapped(*args, **kwargs):
5353
waic = map_args(az.waic)
5454

5555

56-
def gelman_rubin(*args, **kwargs):
57-
warnings.warn("gelman_rubin has been deprecated. In the future, use rhat instead.")
58-
return rhat(*args, **kwargs)
59-
60-
gelman_rubin.__doc__ = rhat.__doc__
61-
62-
63-
def effective_n(*args, **kwargs):
64-
warnings.warn("effective_n has been deprecated. In the future, use ess instead.")
65-
return ess(*args, **kwargs)
66-
67-
effective_n.__doc__ = ess.__doc__
68-
6956
__all__ = [
7057
"bfmi",
7158
"compare",
@@ -78,6 +65,4 @@ def effective_n(*args, **kwargs):
7865
"rhat",
7966
"summary",
8067
"waic",
81-
"gelman_rubin", # deprecated, remove after 3.8
82-
"effective_n", # deprecated, remove after 3.8
8368
]

pymc3/tests/sampler_fixtures.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -149,12 +149,12 @@ def setup_class(cls):
149149

150150
def test_neff(self):
151151
if hasattr(self, 'min_n_eff'):
152-
n_eff = pm.effective_n(self.trace[self.burn:])
152+
n_eff = pm.ess(self.trace[self.burn:])
153153
for var in n_eff:
154154
npt.assert_array_less(self.min_n_eff, n_eff[var])
155155

156156
def test_Rhat(self):
157-
rhat = pm.gelman_rubin(self.trace[self.burn:])
157+
rhat = pm.rhat(self.trace[self.burn:])
158158
for var in rhat:
159159
npt.assert_allclose(rhat[var], 1, rtol=0.01)
160160

pymc3/tests/test_sampling.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ def test_sample_args(self):
103103
assert "'foo'" in str(excinfo.value)
104104

105105
with pytest.raises(ValueError) as excinfo:
106-
pm.sample(50, tune=0, init=None, step_kwargs={"foo": {}})
106+
pm.sample(50, tune=0, init=None, foo={})
107107
assert "foo" in str(excinfo.value)
108108

109109
with pytest.raises(ValueError) as excinfo:

0 commit comments

Comments
 (0)