Home

Awesome

Semiparametrics and NNs (initial release)

1. Experiments and Models

Release code for experiments on influence functions with neural networks. See below for code for automatic derivation of IFs.

Required Libraries and Packages:

python=3.7

pytorch=1.9.0

scikit-learn=0.24.2

scipy=1.6.2

statsmodels=0.12.2

numpy=1.20.3

pandas=1.3.0

LF (v1), CFR, LR, SL, variants

python3 main.py --run RUN1 --N 5000 --starting_iter 0 --num_tuning_trials 15 --num_runs 100 --data_rand 1 --super_learner_k 10 --run_SL 1 --run_treg 1 --run_LR 1 --run_NN 1 --run_NN_SL 1 --run_treg_SL 1 --run_NN_or_multinet 0 --data_masking 0 --layerwise_optim 0 --calibration 0  --dataset synth1

LF (v1), MultiNet, variants

python3 main.py --run RUN2 --N 5000 --starting_iter 0 --num_tuning_trials 15 --num_runs 100 --data_rand 1 --super_learner_k 10 --run_SL 1 --run_treg 1 --run_LR 1 --run_NN 1 --run_NN_SL 1 --run_treg_SL 1 --run_NN_or_multinet 1 --data_masking 0 --layerwise_optim 0 --calibration 0 --dataset synth1

LF (v1), MultiNet + data masking, variants

python3 main.py --run RUN3 --N 5000 --starting_iter 0 --num_tuning_trials 15 --num_runs 100 --data_rand 1 --super_learner_k 10 --run_SL 1 --run_treg 1 --run_LR 1 --run_NN 1 --run_NN_SL 1 --run_treg_SL 1 --run_NN_or_multinet 1 --data_masking 1 --layerwise_optim 0 --calibration 0  --dataset synth1

LF (v1), MultiNet + data masking + layerwise training, variants

python3 main.py --run RUN4 --N 5000 --starting_iter 0 --num_tuning_trials 15 --num_runs 100 --data_rand 1 --super_learner_k 10 --run_SL 1 --run_treg 1 --run_LR 1 --run_NN 1 --run_NN_SL 1 --run_treg_SL 1 --run_NN_or_multinet 1 --data_masking 1 --layerwise_optim 1 --calibration 0  --dataset synth1

Change the dataset with the --dataset flag, set to synth1 (LF v1), synth2 (LF v2), synth3 (LF v3), or IHDP. For IHDP, sample size flag --N is ignored.

If GPU support is available you can add the --gpu 1 flag, although we have found that owing to the high I/O speed in this script it is not necessarily faster that CPU.

2. Automatically Deriving IFs

See the folder auto_IFs. The helpers.py provides the derivation tools, and a demonstration can be found in auto_IF.ipynb.

Required Libraries and Packages:

causaleffect; pycairo