-
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.
- Loading branch information
1 parent
a96b1ae
commit 6b698f7
Showing
4 changed files
with
149 additions
and
19 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,28 @@ | ||
from hydra.experimental import initialize, compose | ||
import logging | ||
import torch | ||
import numpy as np | ||
import random | ||
|
||
from runnables.train import main | ||
from runnables.train_classic import main | ||
|
||
logging.basicConfig(level='info') | ||
|
||
|
||
class TestTarNET: | ||
def test_tarnet(self): | ||
class TestClassicalMethods: | ||
def test_knn(self): | ||
with initialize(config_path="../config"): | ||
args = compose(config_name="config.yaml", overrides=["+dataset=synthetic", | ||
"+repr_net=tarnet", | ||
"+repr_net/synthetic_hparams/tarnet/n500='1.0'", | ||
"+classic_cate=knn", | ||
"exp.seed=10", | ||
"exp.logging=False", | ||
"exp.device=cpu", | ||
"repr_net.num_epochs=5", | ||
"prop_net_cov.num_epochs=5", | ||
"cnf_repr.num_epochs=5", | ||
"prop_net_repr.num_epochs=5"]) | ||
"dataset.n_samples_train=500"]) | ||
results = main(args) | ||
assert results is not None | ||
|
||
def test_causal_forest(self): | ||
with initialize(config_path="../config"): | ||
args = compose(config_name="config.yaml", overrides=["+dataset=synthetic", | ||
"+classic_cate=causal_forest", | ||
"exp.seed=10", | ||
"exp.logging=False", | ||
"dataset.n_samples_train=500"]) | ||
results = main(args) | ||
assert results is not None |
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,129 @@ | ||
from hydra.experimental import initialize, compose | ||
import logging | ||
|
||
from runnables.train import main | ||
|
||
logging.basicConfig(level='info') | ||
|
||
|
||
class TestReprNETs: | ||
def test_tarnet(self): | ||
with initialize(config_path="../config"): | ||
args = compose(config_name="config.yaml", overrides=["+dataset=synthetic", | ||
"+repr_net=tarnet", | ||
"+repr_net/synthetic_hparams/tarnet/n500='1.0'", | ||
"exp.seed=10", | ||
"exp.logging=False", | ||
"exp.device=cpu", | ||
"repr_net.num_epochs=5", | ||
"prop_net_cov.num_epochs=5", | ||
"cnf_repr.num_epochs=5", | ||
"prop_net_repr.num_epochs=5"]) | ||
results = main(args) | ||
assert results is not None | ||
|
||
def test_cfrnet_mmd(self): | ||
with initialize(config_path="../config"): | ||
args = compose(config_name="config.yaml", overrides=["+dataset=synthetic", | ||
"+repr_net=cfrnet", | ||
"+repr_net/synthetic_hparams/cfrnet/n500/mmd_0_5='1.0'", | ||
"exp.seed=10", | ||
"exp.logging=False", | ||
"exp.device=cpu", | ||
"repr_net.num_epochs=5", | ||
"prop_net_cov.num_epochs=5", | ||
"cnf_repr.num_epochs=5", | ||
"prop_net_repr.num_epochs=5"]) | ||
results = main(args) | ||
assert results is not None | ||
|
||
def test_cfrnet_wass(self): | ||
with initialize(config_path="../config"): | ||
args = compose(config_name="config.yaml", overrides=["+dataset=synthetic", | ||
"+repr_net=cfrnet", | ||
"+repr_net/synthetic_hparams/cfrnet/n500/wass_2_0='1.0'", | ||
"exp.seed=10", | ||
"exp.logging=False", | ||
"exp.device=cpu", | ||
"repr_net.num_epochs=5", | ||
"prop_net_cov.num_epochs=5", | ||
"cnf_repr.num_epochs=5", | ||
"prop_net_repr.num_epochs=5"]) | ||
results = main(args) | ||
assert results is not None | ||
|
||
def test_rcfrnet(self): | ||
with initialize(config_path="../config"): | ||
args = compose(config_name="config.yaml", overrides=["+dataset=synthetic", | ||
"+repr_net=rcfrnet", | ||
"+repr_net/synthetic_hparams/rcfrnet/n500='1.0'", | ||
"exp.seed=10", | ||
"exp.logging=False", | ||
"exp.device=cpu", | ||
"repr_net.num_epochs=5", | ||
"prop_net_cov.num_epochs=5", | ||
"cnf_repr.num_epochs=5", | ||
"prop_net_repr.num_epochs=5"]) | ||
results = main(args) | ||
assert results is not None | ||
|
||
def test_cfrisw(self): | ||
with initialize(config_path="../config"): | ||
args = compose(config_name="config.yaml", overrides=["+dataset=synthetic", | ||
"+repr_net=cfrisw", | ||
"+repr_net/synthetic_hparams/cfrisw/n500='1.0'", | ||
"exp.seed=10", | ||
"exp.logging=False", | ||
"exp.device=cpu", | ||
"repr_net.num_epochs=5", | ||
"prop_net_cov.num_epochs=5", | ||
"cnf_repr.num_epochs=5", | ||
"prop_net_repr.num_epochs=5"]) | ||
results = main(args) | ||
assert results is not None | ||
|
||
def test_bwcfr(self): | ||
with initialize(config_path="../config"): | ||
args = compose(config_name="config.yaml", overrides=["+dataset=synthetic", | ||
"+repr_net=bwcfr", | ||
"+repr_net/synthetic_hparams/bwcfr/n500='1.0'", | ||
"exp.seed=10", | ||
"exp.logging=False", | ||
"exp.device=cpu", | ||
"repr_net.num_epochs=5", | ||
"prop_net_cov.num_epochs=5", | ||
"cnf_repr.num_epochs=5", | ||
"prop_net_repr.num_epochs=5"]) | ||
results = main(args) | ||
assert results is not None | ||
|
||
def test_bnnet(self): | ||
with initialize(config_path="../config"): | ||
args = compose(config_name="config.yaml", overrides=["+dataset=synthetic", | ||
"+repr_net=bnnet", | ||
"+repr_net/synthetic_hparams/bnnet/n500='1.0'", | ||
"exp.seed=10", | ||
"exp.logging=False", | ||
"exp.device=cpu", | ||
"repr_net.num_epochs=5", | ||
"prop_net_cov.num_epochs=5", | ||
"cnf_repr.num_epochs=5", | ||
"prop_net_repr.num_epochs=5"]) | ||
results = main(args) | ||
assert results is not None | ||
|
||
def test_inv_tarnet(self): | ||
with initialize(config_path="../config"): | ||
args = compose(config_name="config.yaml", overrides=["+dataset=synthetic", | ||
"+repr_net=inv_tarnet", | ||
"+repr_net/synthetic_hparams/inv_tarnet/n500='1.0'", | ||
"exp.seed=10", | ||
"exp.logging=False", | ||
"exp.device=cpu", | ||
"repr_net.num_epochs=5", | ||
"prop_net_cov.num_epochs=5", | ||
"cnf_repr.num_epochs=5", | ||
"prop_net_repr.num_epochs=5"]) | ||
|
||
results = main(args) | ||
assert results is not None |