CausalEGM.causalEGM.CausalEGM

class CausalEGM.causalEGM.CausalEGM(params, timestamp=None, random_seed=None)[source]

Implementation of the CausalEGM model.

Parameters:
  • params – Dict object denoting the hyperparameters for deployments and building the model architecture. See examples under the src/configs folder.

  • timestamp – Str object denoting the timestemp for specificing when the model is instanced. Default: None.

  • random_seed – Int object denoting the random seed for controling randomness. Default: None.

Examples

>>> from CausalEGM import CausalEGM, Sim_Hirano_Imbens_sampler
>>> import yaml
>>> params = yaml.safe_load(open('src/configs/Sim_Hirano_Imbens.yaml', 'r'))
>>> x,y,v = Sim_Hirano_Imbens_sampler(batch_size=32).load_all()
>>> model = CausalEGM(params=params,random_seed=12)
>>> model.train(data=[x,y,v],n_iter=30000,save_format='npy')
__init__(params, timestamp=None, random_seed=None)[source]

Methods

__init__(params[, timestamp, random_seed])

evaluate(data[, nb_intervals])

Internal evaluation in the training process of CausalEGM.

getADRF(x_list[, data_v])

Get average dosage response function (ADRF) in CausalEGM.

getCATE(data_v)

Get conditional average treatment effect (CATE) in CausalEGM.

get_config()

Get the parameters CausalEGM model.

initialize_nets([print_summary])

Initialize all the networks in CausalEGM.

predict(data_x, data_v)

Predict the outcome given treatment and covariates in CausalEGM.

save(fname, data)

Save the data to the specified path.

train([data, data_file, sep, header, ...])

Train a CausalEGM model given the input data.

train_disc_step(data_z, data_v)

Training step for the discrinimator(s) in the CausalEGM model.

train_gen_step(data_z, data_v, data_x, data_y)

Training step for the generators in the CausalEGM model.