Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #288: remove deprecated 'model' property in tests. #291

Merged
merged 1 commit into from
Mar 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading