-
Notifications
You must be signed in to change notification settings - Fork 780
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* resolves #639, credit due to Dong Liu * avoid importing * * add optional tf pytest marker, option test_dragonnet * lint * pass on tensorflow ImportError * update CONTRIBUTING, docs/installation.rst --------- Co-authored-by: Roland Stevenson <rolandrmgservices@gmail.com>
- Loading branch information
1 parent
9e1f892
commit 1d8e095
Showing
5 changed files
with
92 additions
and
1 deletion.
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
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,23 @@ | ||
try: | ||
from causalml.inference.tf import DragonNet | ||
except ImportError: | ||
pass | ||
from causalml.dataset.regression import simulate_nuisance_and_easy_treatment | ||
import shutil | ||
import pytest | ||
|
||
|
||
@pytest.mark.tf | ||
def test_save_load_dragonnet(): | ||
y, X, w, tau, b, e = simulate_nuisance_and_easy_treatment(n=1000) | ||
|
||
dragon = DragonNet(neurons_per_layer=200, targeted_reg=True, verbose=False) | ||
dragon_ite = dragon.fit_predict(X, w, y, return_components=False) | ||
dragon_ate = dragon_ite.mean() | ||
dragon.save("smaug") | ||
|
||
smaug = DragonNet() | ||
smaug.load("smaug") | ||
shutil.rmtree("smaug") | ||
|
||
assert smaug.predict_tau(X).mean() == dragon_ate |