Package: ltce
Estimating the long-term treatment impact is crucial in many areas such as business and medicine.  The main difficulty of this problem is that observing the long-term effect requires unacceptable costs and duration typically far longer than the decision-making window. The Long-term causal effect packages provided an integration of recent progress in this problem, including models such as SInd, LT-Transformer. This sort of method would typically utilize two datasets, one contains observed long-term outcomes for model training and another one with unobserved long-term outcomes to be predicted.Install GuidelinesBelow shows how to install and use ltce packages.Requirements for ltceThis project is established based on pytorch. Before installing the ltce packages, please go tohttps://pytorch.org/to download a suitable pytorch version.
The pytorch with cuda is preferred due to efficiency reason.
Once pytorch is ready, you can move to the next step.Download model & datasetltce could be installed via:pip install ltceorpip install ltce --index-url https://pypi.org/simplein case the mirror does not synchronized the newest version.Using modelsThe long-term effect estimation problem typically requires 2 dataset, one observational dataset with the desired long-term outcomes, and an experimental dataset where long-term outcome is missing.
Each dataset contains 4 types of data: the covariate (X), the treatment (W), the surrogates (S) and the long-term outcome (Y).
The requirement for each model is as belowmodelX(obs)W(obs)S(obs)Y(obs)X(exp)W(exp)S(exp)Y(exp)SInd-Linear [1]YNYYYNYNSInd_MLP [2]YNYYYNYNSInd-DLinear [4]YNYYYNYNLTEE [3]YYNYYYNNLASER [2]YYYYYYYNR TransformerYYYYYYYNC TransformerYYYYYYYNExamples for Using ltceThis section would demonstrate an example for each model.Preparing datasetsA simulation dataset could be downloaded via:git clone https://github.com/zhangyuanyuzyy/LT-Transformer-Dataset.gitUnpack the downloaded dataset and put directorydatasetunder a givenrootdirectory, such that.root
└── dataset
    ├── synthetic dataset 1
    ├── synthetic dataset 2
    ├── synthetic dataset 3
    ├── synthetic dataset 4
    ├── synthetic dataset 5
    ├── synthetic dataset 6
    ├── synthetic dataset 7
    ├── synthetic dataset 8
    └── synthetic dataset 9At present, synthetic dataset 7, 8 and 9 are not available because they are relatively large. The basic information of these 9 datasets are shown in the table below.DatasetSize(Obs, Exp)SNREstimated SNR15000,20002.1117.7325000,20007.3241.1335000,200093.0850.64450000,200002.333.73550000,200009.1044.17650000,2000077.33362.7971000000,5000002.131.4681000000,50000010.1632.2691000000,50000094.2456.80Running modelIf dataset and ltce are both ready, you could run our examples viafrom ltce.example.{testmodel} import training_pipeline

dataset = '{root}' + '/dataset/synthetic dataset {testdataset}/'
training_pipeline(dataset)rootis the root directory where you put the downloaded dataset.testmodelcould be chosen from rtransformer, ctransformer, sind_linear, sind_mlp, sind_dlinear, ltee, lasertestdatasetcould be chosen between 1 and 9. However, the hyper-parameters setting are only suitable for dataset 1, 2 and 3, which is recommended as a starting point.
Below shows 3 concrete examples of running ltce models. Suppose the root directory ishome/. Replace it with your own directory.R Transformer:from ltce.example.rtransformer import training_pipeline

dataset = 'home/dataset/synthetic dataset 3/'
training_pipeline(dataset)SInd-DLinear:from ltce.example.sind_dlienar import training_pipeline

dataset = 'home/dataset/synthetic dataset 3/'
training_pipeline(dataset)LTEE:from ltce.example.ltee import training_pipeline

dataset = 'home/dataset/synthetic dataset 3/'
training_pipeline(dataset)About Versionversion 0.2.0Running examples for each model were supplemented. These examples are suitable for users to learn how to work with ltce.version 0.1.0This is the first stable version of ltce. It contained models 7 models, including 3 SInd-based model (SInd-Linear, SInd-MLP, SInd-DLinear), 2 transformer-based models (R Transformer, C Transformer), LTEE and LASER.version 0.1.0b1This is the first beta version of ltce. Happily, it was born with two transformer-based models, CTransformer and RTransformer. More models would be included in the future versions.References[1] Susan Athey, Raj Chetty, Guido Imbens, and Hyunseung Kang. 2019. The Surrogate Index: Combining Short-Term Proxies to Estimate Long-Term TreatmentEffects More Rapidly and Precisely. Randomized Social Experiments eJournal (2019).[2] Ruichu Cai, Weilin Chen, Zeqin Yang, Shu Wan, Chen Zheng, Xiaoqing Yang, and Jiecheng Guo. 2022. Long-term Causal Effects Estimation via Latent Surrogates Representation Learning. ArXiv abs/2208.04589 (2022).[3] Lu Cheng, Ruocheng Guo, and Huan Liu. 2020. Long-Term Effect Estimation with Surrogate Representation. Proceedings of the 14th ACM International Conference on Web Search and Data Mining (2020).[4] Ailing Zeng, Mu-Hwa Chen, L. Zhang, and Qiang Xu. 2022. Are Transformers Effective for Time Series Forecasting?. In AAAI Conference on Artificial Intelligence.Part of the code in this package is based on the followings references:https://github.com/siamakz/iVAE/https://github.com/zhangyuanyuzyy/LT-Transformer