Skip to content

Commit a6e6fa8

Browse files
sotaggwilliambdeanzaxtax
authored
doc: remove MutableData (#7900)
* Remove deprecated classes from API docs * Replace MutableData with Data * Remove warnings --------- Co-authored-by: Will Dean <57733339+williambdean@users.noreply.github.com> Co-authored-by: Rob Zinkov <rob@zinkov.com>
1 parent 3a0186e commit a6e6fa8

File tree

4 files changed

+11
-13
lines changed

4 files changed

+11
-13
lines changed

docs/source/api/data.rst

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ Data
66
.. autosummary::
77
:toctree: generated/
88

9-
ConstantData
10-
MutableData
11-
get_data
129
Data
10+
get_data
1311
Minibatch

pymc/gp/hsgp_approx.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -620,7 +620,7 @@ def prior_linearized(self, X: TensorLike):
620620
they may share the same basis.
621621
622622
Correct results when using `prior_linearized` in tandem with
623-
`pm.set_data` and `pm.MutableData` require that the `Xs` are
623+
`pm.set_data` and `pm.Data` require that the `Xs` are
624624
zero-centered, so its mean must be subtracted.
625625
626626
An example is given below.

pymc/sampling/forward.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -605,8 +605,8 @@ def sample_posterior_predictive(
605605
606606
import pymc as pm
607607
608-
with pm.Model(coords_mutable={"trial": [0, 1, 2]}) as model:
609-
x = pm.MutableData("x", [-1, 0, 1], dims=["trial"])
608+
with pm.Model(coords={"trial": [0, 1, 2]}) as model:
609+
x = pm.Data("x", [-1, 0, 1], dims=["trial"])
610610
beta = pm.Normal("beta")
611611
noise = pm.HalfNormal("noise")
612612
y = pm.Normal("y", mu=x * beta, sigma=noise, observed=[-2, 0, 3], dims=["trial"])
@@ -632,8 +632,8 @@ def sample_posterior_predictive(
632632
633633
.. code-block:: python
634634
635-
with pm.Model(coords_mutable={"trial": [3, 4]}) as predictions_model:
636-
x = pm.MutableData("x", [-2, 2], dims=["trial"])
635+
with pm.Model(coords={"trial": [3, 4]}) as predictions_model:
636+
x = pm.Data("x", [-2, 2], dims=["trial"])
637637
beta = pm.Normal("beta")
638638
noise = pm.HalfNormal("noise")
639639
y = pm.Normal("y", mu=x * beta, sigma=noise, dims=["trial"])
@@ -649,8 +649,8 @@ def sample_posterior_predictive(
649649
650650
.. code-block:: python
651651
652-
with pm.Model(coords_mutable={"trial": [3, 4]}) as distinct_predictions_model:
653-
x = pm.MutableData("x", [-2, 2], dims=["trial"])
652+
with pm.Model(coords={"trial": [3, 4]}) as distinct_predictions_model:
653+
x = pm.Data("x", [-2, 2], dims=["trial"])
654654
beta = pm.Normal("beta")
655655
noise = pm.HalfNormal("noise")
656656
extra_noise = pm.HalfNormal("extra_noise", sigma=noise)

tests/sampling/test_forward.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1022,7 +1022,7 @@ def test_logging_sampled_basic_rvs_posterior_mutable(self, mock_sample_results,
10221022
caplog.clear()
10231023
elif kind == "Dataset":
10241024
# Dataset has all MCMC posterior samples and the values of the coordinates. This
1025-
# enables it to see that the coordinates have not changed, but the MutableData is
1025+
# enables it to see that the coordinates have not changed, but the Data is
10261026
# assumed volatile by default
10271027
assert caplog.record_tuples == [
10281028
("pymc.sampling.forward", logging.INFO, "Sampling: [b, y]")
@@ -1031,7 +1031,7 @@ def test_logging_sampled_basic_rvs_posterior_mutable(self, mock_sample_results,
10311031

10321032
original_offsets = model["offsets"].get_value()
10331033
with model:
1034-
# Changing the MutableData values. This will only be picked up by InferenceData
1034+
# Changing the Data values. This will only be picked up by InferenceData
10351035
pm.set_data({"offsets": original_offsets + 1})
10361036
pm.sample_posterior_predictive(samples)
10371037
if kind == "MultiTrace":
@@ -1072,7 +1072,7 @@ def test_logging_sampled_basic_rvs_posterior_mutable(self, mock_sample_results,
10721072
caplog.clear()
10731073

10741074
with model:
1075-
# Changing the mutable coordinate values, but not shape, and also changing MutableData.
1075+
# Changing the mutable coordinate values, but not shape, and also changing Data.
10761076
# This will trigger resampling of all variables
10771077
model.set_dim("name", new_length=3, coord_values=["A", "B", "D"])
10781078
pm.set_data({"offsets": original_offsets + 1, "y_obs": np.zeros((10, 3))})

0 commit comments

Comments
 (0)