-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
43ed32b
commit 993efdf
Showing
10 changed files
with
112 additions
and
67 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
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
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
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 |
---|---|---|
|
@@ -5,7 +5,7 @@ | |
|
||
setuptools.setup( | ||
name="causal-curve", | ||
version="0.1.1", | ||
version="0.1.2", | ||
author="Roni Kobrosly", | ||
author_email="[email protected]", | ||
description="A python library with tools to perform causal inference using \ | ||
|
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
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
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 |
---|---|---|
@@ -1 +1,28 @@ | ||
""" Integration tests of the tmle.py module """ | ||
|
||
import pandas as pd | ||
|
||
from causal_curve import TMLE | ||
from tests.test_helpers import assert_df_equal | ||
|
||
|
||
def test_full_tmle_flow(dataset_fixture): | ||
""" | ||
Tests the full flow of the TMLE tool | ||
""" | ||
|
||
tmle = TMLE( | ||
treatment_grid_bins=[22.1, 30, 40, 50, 60, 70, 80.1], | ||
random_seed=100, | ||
verbose=False, | ||
) | ||
tmle.fit( | ||
T=dataset_fixture["treatment"], | ||
X=dataset_fixture[["x1", "x2"]], | ||
y=dataset_fixture["outcome"], | ||
) | ||
tmle_results = tmle.calculate_CDRC(0.95) | ||
|
||
assert isinstance(tmle_results, pd.DataFrame) | ||
check = tmle_results.columns == ["Treatment", "CDRC", "Lower_CI", "Upper_CI"] | ||
assert check.all() |
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
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 |
---|---|---|
@@ -1 +1,33 @@ | ||
""" Unit tests of the gps.py module """ | ||
|
||
|
||
import pandas as pd | ||
from pygam import LinearGAM | ||
|
||
from causal_curve import GPS | ||
from tests.test_helpers import assert_df_equal | ||
|
||
|
||
def test_GPS_fit(dataset_fixture): | ||
""" | ||
Tests the fit method GPS tool | ||
""" | ||
|
||
gps = GPS( | ||
treatment_grid_num=10, | ||
lower_grid_constraint=0.0, | ||
upper_grid_constraint=1.0, | ||
spline_order=3, | ||
n_splines=10, | ||
max_iter=100, | ||
random_seed=100, | ||
verbose=False, | ||
) | ||
gps.fit( | ||
T=dataset_fixture["treatment"], | ||
X=dataset_fixture["x1"], | ||
y=dataset_fixture["outcome"], | ||
) | ||
|
||
assert isinstance(gps.gam_results, LinearGAM) | ||
assert gps.gps.shape == (500,) |
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 |
---|---|---|
@@ -1 +1,28 @@ | ||
""" Unit tests of the tmle.py module """ | ||
|
||
|
||
import pandas as pd | ||
|
||
from causal_curve import TMLE | ||
from tests.test_helpers import assert_df_equal | ||
|
||
|
||
def test_TMLE_fit(dataset_fixture): | ||
""" | ||
Tests the fit method GPS tool | ||
""" | ||
|
||
tmle = TMLE( | ||
treatment_grid_bins=[22.1, 30, 40, 50, 60, 70, 80.1], | ||
random_seed=100, | ||
verbose=False, | ||
) | ||
tmle.fit( | ||
T=dataset_fixture["treatment"], | ||
X=dataset_fixture[["x1", "x2"]], | ||
y=dataset_fixture["outcome"], | ||
) | ||
|
||
assert tmle.n_obs == 72 | ||
assert len(tmle.psi_list) == 5 | ||
assert len(tmle.std_error_ic_list) == 5 |