Skip to content

Commit

Permalink
Merge pull request #291 from anevolbap/issue_288-warnings_tests
Browse files Browse the repository at this point in the history
Fix #288: remove deprecated 'model' property in tests.
  • Loading branch information
drbenvincent authored Mar 1, 2024
2 parents a63a7f9 + 60e537c commit d5e493c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions causalpy/pymc_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def _data_setter(self, X) -> None:
This method is used internally to register new data for the model for
prediction.
"""
with self.model:
with self:
pm.set_data({"X": X})

def fit(self, X, y, coords: Optional[Dict[str, Any]] = None) -> None:
Expand All @@ -105,7 +105,7 @@ def fit(self, X, y, coords: Optional[Dict[str, Any]] = None) -> None:
random_seed = None

self.build_model(X, y, coords)
with self.model:
with self:
self.idata = pm.sample(**self.sample_kwargs)
self.idata.extend(pm.sample_prior_predictive(random_seed=random_seed))
self.idata.extend(
Expand All @@ -125,7 +125,7 @@ def predict(self, X):
"""

self._data_setter(X)
with self.model: # sample with new input data
with self: # sample with new input data
post_pred = pm.sample_posterior_predictive(
self.idata, var_names=["y_hat", "mu"], progressbar=False
)
Expand Down Expand Up @@ -354,7 +354,7 @@ def fit(self, X, Z, y, t, coords, priors):
distributions.
"""
self.build_model(X, Z, y, t, coords, priors)
with self.model:
with self:
self.idata = pm.sample(**self.sample_kwargs)
self.idata.extend(pm.sample_prior_predictive())
self.idata.extend(
Expand Down

0 comments on commit d5e493c

Please sign in to comment.