Skip to content

Commit 43ddea3

Browse files
committed
Remove deprecated model methods
1 parent 2fb312b commit 43ddea3

File tree

2 files changed

+4
-56
lines changed

2 files changed

+4
-56
lines changed

pymc/model/core.py

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -886,27 +886,11 @@ def unobserved_value_vars(self):
886886

887887
return vars + untransformed_vars + deterministics
888888

889-
@property
890-
def disc_vars(self):
891-
warnings.warn(
892-
"Model.disc_vars has been deprecated. Use Model.discrete_value_vars instead.",
893-
FutureWarning,
894-
)
895-
return self.discrete_value_vars
896-
897889
@property
898890
def discrete_value_vars(self):
899891
"""All the discrete value variables in the model"""
900892
return list(typefilter(self.value_vars, discrete_types))
901893

902-
@property
903-
def cont_vars(self):
904-
warnings.warn(
905-
"Model.cont_vars has been deprecated. Use Model.continuous_value_vars instead.",
906-
FutureWarning,
907-
)
908-
return self.continuous_value_vars
909-
910894
@property
911895
def continuous_value_vars(self):
912896
"""All the continuous value variables in the model"""
@@ -935,18 +919,6 @@ def unobserved_RVs(self):
935919
"""
936920
return self.free_RVs + self.deterministics
937921

938-
@property
939-
def RV_dims(self) -> Dict[str, Tuple[Union[str, None], ...]]:
940-
"""Tuples of dimension names for specific model variables.
941-
942-
Entries in the tuples may be ``None``, if the RV dimension was not given a name.
943-
"""
944-
warnings.warn(
945-
"Model.RV_dims is deprecated. Use Model.named_vars_to_dims instead.",
946-
FutureWarning,
947-
)
948-
return self.named_vars_to_dims
949-
950922
@property
951923
def coords(self) -> Dict[str, Union[Tuple, None]]:
952924
"""Coordinate values for model dimensions."""
@@ -1090,18 +1062,6 @@ def initial_point(self, random_seed: SeedSequenceSeed = None) -> Dict[str, np.nd
10901062
fn = make_initial_point_fn(model=self, return_transformed=True)
10911063
return Point(fn(random_seed), model=self)
10921064

1093-
@property
1094-
def initial_values(self) -> Dict[TensorVariable, Optional[Union[np.ndarray, Variable, str]]]:
1095-
"""Maps transformed variables to initial value placeholders.
1096-
1097-
Keys are the random variables (as returned by e.g. ``pm.Uniform()``) and
1098-
values are the numeric/symbolic initial values, strings denoting the strategy to get them, or None.
1099-
"""
1100-
warnings.warn(
1101-
"Model.initial_values is deprecated. Use Model.rvs_to_initial_values instead."
1102-
)
1103-
return self.rvs_to_initial_values
1104-
11051065
def set_initval(self, rv_var, initval):
11061066
"""Sets an initial value (strategy) for a random variable."""
11071067
if initval is not None and not isinstance(initval, (Variable, str)):

tests/model/test_core.py

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -705,17 +705,17 @@ def test_set_initval():
705705
alpha = pm.HalfNormal("alpha", initval=100)
706706
value = pm.NegativeBinomial("value", mu=mu, alpha=alpha)
707707

708-
assert np.array_equal(model.initial_values[mu], np.array([[100.0]]))
709-
np.testing.assert_array_equal(model.initial_values[alpha], np.array(100))
710-
assert model.initial_values[value] is None
708+
assert np.array_equal(model.rvs_to_initial_values[mu], np.array([[100.0]]))
709+
np.testing.assert_array_equal(model.rvs_to_initial_values[alpha], np.array(100))
710+
assert model.rvs_to_initial_values[value] is None
711711

712712
# `Flat` cannot be sampled, so let's make sure that doesn't break initial
713713
# value computations
714714
with pm.Model() as model:
715715
x = pm.Flat("x")
716716
y = pm.Normal("y", x, 1)
717717

718-
assert y in model.initial_values
718+
assert y in model.rvs_to_initial_values
719719

720720

721721
def test_datalogp_multiple_shapes():
@@ -974,18 +974,6 @@ def test_set_data_constant_shape_error():
974974
pmodel.set_data("y", np.arange(10))
975975

976976

977-
def test_model_deprecation_warning():
978-
with pm.Model() as m:
979-
x = pm.Normal("x", 0, 1, size=2)
980-
y = pm.LogNormal("y", 0, 1, size=2)
981-
982-
with pytest.warns(FutureWarning):
983-
m.disc_vars
984-
985-
with pytest.warns(FutureWarning):
986-
m.cont_vars
987-
988-
989977
@pytest.mark.parametrize("jacobian", [True, False])
990978
def test_model_logp(jacobian):
991979
with pm.Model() as m:

0 commit comments

Comments
 (0)