-
-
Notifications
You must be signed in to change notification settings - Fork 121
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
Refactor tests to share data generation code #531
Conversation
Codecov Report
@@ Coverage Diff @@
## main #531 +/- ##
==========================================
- Coverage 86.84% 86.78% -0.06%
==========================================
Files 32 32
Lines 2622 2611 -11
==========================================
- Hits 2277 2266 -11
Misses 345 345
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Thanks for all the amazing work @markgoodhead !! One addition, I think that @canyon289 was actually saying we could have something like bambi/bambi/tests/test_model_construction.py Lines 289 to 304 in 91903c8
correct me if i'm wrong Something like the following... @pytest.mark.parametrize("method", ["nuts_numpyro", "nuts_blackjax"])
def test_logistic_regression_alternative_samplers(logistic_regression_data, method):
model = Model("y ~ x", logistic_regression_data, family="bernoulli")
model.fit(method=method, chain_method="vectorized") On top of that, I would decrease |
This is what I'm saying :) |
|
||
|
||
@pytest.fixture(scope="module") | ||
def linear_regression_data(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great too!
bambi/tests/test_built_models.py
Outdated
y = pd.Series(np.random.choice(["a", "b"], 50), dtype="category") | ||
data = pd.DataFrame({"y": y, "x": np.random.normal(size=50)}) | ||
model = Model("y ~ x", data, family="bernoulli") | ||
def test_logistic_regression_numpyro(logistic_regression_data): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These next couple could be parametrized so now theres only one test. We're really squeezing code lines out now but I hope its a good learning experience!
Comments addressed 👍 |
Thank you, @markgoodhead, this is great! |
Small PR to address #530