Skip to content

Commit df32146

Browse files
committed
Replace MutableData with Data
1 parent 16ac99a commit df32146

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

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
@@ -607,8 +607,8 @@ def sample_posterior_predictive(
607607
608608
import pymc as pm
609609
610-
with pm.Model(coords_mutable={"trial": [0, 1, 2]}) as model:
611-
x = pm.MutableData("x", [-1, 0, 1], dims=["trial"])
610+
with pm.Model(coords={"trial": [0, 1, 2]}) as model:
611+
x = pm.Data("x", [-1, 0, 1], dims=["trial"])
612612
beta = pm.Normal("beta")
613613
noise = pm.HalfNormal("noise")
614614
y = pm.Normal("y", mu=x * beta, sigma=noise, observed=[-2, 0, 3], dims=["trial"])
@@ -634,8 +634,8 @@ def sample_posterior_predictive(
634634
635635
.. code:: python
636636
637-
with pm.Model(coords_mutable={"trial": [3, 4]}) as predictions_model:
638-
x = pm.MutableData("x", [-2, 2], dims=["trial"])
637+
with pm.Model(coords={"trial": [3, 4]}) as predictions_model:
638+
x = pm.Data("x", [-2, 2], dims=["trial"])
639639
beta = pm.Normal("beta")
640640
noise = pm.HalfNormal("noise")
641641
y = pm.Normal("y", mu=x * beta, sigma=noise, dims=["trial"])
@@ -649,8 +649,8 @@ def sample_posterior_predictive(
649649
650650
.. code:: 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)