forked from bambinos/bambi
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add tests for non-plotting functions, module docstring, and update fu…
…nction calls
- Loading branch information
1 parent
0bf80e0
commit 5f4c7cf
Showing
2 changed files
with
87 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
""" | ||
This module contains tests for the non-plotting functions of the 'interpret' | ||
sub-package. In some cases, 'comparisons()', 'predictions()' and 'slopes()' | ||
contain arguments not in their respective plotting functions. Such arguments | ||
are tested here. | ||
""" | ||
import pandas as pd | ||
import pytest | ||
|
||
import bambi as bmb | ||
|
||
|
||
@pytest.fixture(scope="module") | ||
def mtcars(): | ||
data = bmb.load_data('mtcars') | ||
data["am"] = pd.Categorical(data["am"], categories=[0, 1], ordered=True) | ||
model = bmb.Model("mpg ~ hp * drat * am", data) | ||
idata = model.fit(tune=500, draws=500, random_seed=1234) | ||
return model, idata | ||
|
||
|
||
@pytest.mark.parametrize("return_posterior", [True, False]) | ||
def test_return_posterior(mtcars, return_posterior): | ||
model, idata = mtcars | ||
|
||
bmb.interpret.predictions( | ||
model, idata, ["hp", "wt"], return_posterior=return_posterior | ||
) | ||
bmb.interpret.comparisons( | ||
model, idata, "hp", "wt", return_posterior=return_posterior | ||
) | ||
bmb.interpret.slopes( | ||
model, idata, "hp", "wt", return_posterior=return_posterior | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters