Skip to content
Merged
Show file tree
Hide file tree
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
12 changes: 6 additions & 6 deletions causalpy/pymc_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ class ModelBuilder(pm.Model):
>>> class MyToyModel(ModelBuilder):
... def build_model(self, X, y, coords):
... with self:
... X_ = pm.MutableData(name="X", value=X)
... y_ = pm.MutableData(name="y", value=y)
... X_ = pm.Data(name="X", value=X)
... y_ = pm.Data(name="y", value=y)
... beta = pm.Normal("beta", mu=0, sigma=1, shape=X_.shape[1])
... sigma = pm.HalfNormal("sigma", sigma=1)
... mu = pm.Deterministic("mu", pm.math.dot(X_, beta))
Expand Down Expand Up @@ -190,8 +190,8 @@ def build_model(self, X, y, coords):
with self:
self.add_coords(coords)
n_predictors = X.shape[1]
X = pm.MutableData("X", X, dims=["obs_ind", "coeffs"])
y = pm.MutableData("y", y[:, 0], dims="obs_ind")
X = pm.Data("X", X, dims=["obs_ind", "coeffs"])
y = pm.Data("y", y[:, 0], dims="obs_ind")
# TODO: There we should allow user-specified priors here
beta = pm.Dirichlet("beta", a=np.ones(n_predictors), dims="coeffs")
# beta = pm.Dirichlet(
Expand Down Expand Up @@ -245,8 +245,8 @@ def build_model(self, X, y, coords):
"""
with self:
self.add_coords(coords)
X = pm.MutableData("X", X, dims=["obs_ind", "coeffs"])
y = pm.MutableData("y", y[:, 0], dims="obs_ind")
X = pm.Data("X", X, dims=["obs_ind", "coeffs"])
y = pm.Data("y", y[:, 0], dims="obs_ind")
beta = pm.Normal("beta", 0, 50, dims="coeffs")
sigma = pm.HalfNormal("sigma", 1)
mu = pm.Deterministic("mu", pm.math.dot(X, beta), dims="obs_ind")
Expand Down
4 changes: 2 additions & 2 deletions causalpy/tests/test_pymc_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ def build_model(self, X, y, coords):
This is a basic 1-variable linear regression model for use in tests.
"""
with self:
X_ = pm.MutableData(name="X", value=X)
y_ = pm.MutableData(name="y", value=y)
X_ = pm.Data(name="X", value=X)
y_ = pm.Data(name="y", value=y)
beta = pm.Normal("beta", mu=0, sigma=1, shape=X_.shape[1])
sigma = pm.HalfNormal("sigma", sigma=1)
mu = pm.Deterministic("mu", pm.math.dot(X_, beta))
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ dependencies = [
"numpy<1.26.0",
"pandas",
"patsy",
"pymc>=5.0.0",
"pymc>=5.14.0",
"scikit-learn>=1",
"scipy",
"seaborn>=0.11.2",
Expand Down