Skip to content

Commit d8444ee

Browse files
import bambi as bmb in tests (#662)
* import bambi as bmb in tests * documentation on custom prior (#656) * documentation on custom prior * changes as suggeted by Tomás * minor changes * fixed failed tests b/c of regex match copy and paste mistake --------- Co-authored-by: Surya Mudimi <surya.mudimi@gmail.com>
1 parent 1523650 commit d8444ee

9 files changed

+227
-238
lines changed

tests/test_aliases.py

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
import pytest
22

3-
from bambi import load_data, Formula, Model
3+
import bambi as bmb
44

55

66
@pytest.fixture(scope="module")
77
def my_data():
8-
return load_data("my_data")
8+
return bmb.load_data("my_data")
99

1010

1111
@pytest.fixture(scope="module")
1212
def anes():
13-
return load_data("ANES")
13+
return bmb.load_data("ANES")
1414

1515

1616
def test_non_distributional_model(my_data):
1717
# Plain model
18-
formula = Formula("y ~ x")
19-
model = Model(formula, my_data)
18+
formula = bmb.Formula("y ~ x")
19+
model = bmb.Model(formula, my_data)
2020
idata = model.fit(tune=100, draws=100)
2121
model.predict(idata)
2222

@@ -34,8 +34,8 @@ def test_non_distributional_model(my_data):
3434

3535

3636
def test_distributional_model(my_data):
37-
formula = Formula("y ~ x", "sigma ~ x")
38-
model = Model(formula, my_data)
37+
formula = bmb.Formula("y ~ x", "sigma ~ x")
38+
model = bmb.Model(formula, my_data)
3939
idata = model.fit(tune=100, draws=100)
4040
model.predict(idata)
4141

@@ -74,7 +74,7 @@ def test_distributional_model(my_data):
7474

7575

7676
def test_non_distributional_model_with_categories(anes):
77-
model = Model("vote[clinton] ~ age + age:party_id", anes, family="bernoulli")
77+
model = bmb.Model("vote[clinton] ~ age + age:party_id", anes, family="bernoulli")
7878
idata = model.fit(tune=100, draws=100)
7979
model.predict(idata)
8080
assert list(idata.posterior.coords) == ["chain", "draw", "age:party_id_dim", "vote_obs"]

0 commit comments

Comments
 (0)