We provide the official implementation of Time Series Generation with Masked Autoencoder under the folder MAI.
You may implement experiments on Stock, Sine, and Energy according to the README.md under MAI.
We also provide three jupyter notes for you to preliminarily check the results.
- ExtraMAE.ipynb shows experiments on visualization, discrimination scores, prediction scores, and ablation study.
- Imputaition.ipynb shows results for imputation
- MaskRatio.ipynb shows results in the study of mask ratios.
The jupyter notes rely on large experiment results. Therefore, the readers cannot run them directly. You may find the links for all results of experiments and runnable jupyter notes in SupplementaryMaterial.pdf.
The folder MAI provides the official implementation of Time Series Generation with Masked Autoencoder.
We summarize the prediction, discrimination, and visualization results in summary.ipynb. You may refer to it directly or reimplement our experiments by the steps below.
Pytorch implementation of ExtraMAE can be found in ./MAI/models.py
. All supporting files are stored in ./MAI/modules/*
.
modules include:
utils.py
stores all utility functionsgeneration.py
generates masks and synthetic datavisualization.py
visualize the original data and synthetic data by PCA plots, t-SNE plots, and dot plots.
Datasets are stored in ./MAI/data/*
Metrics for assessing the quality of synthetic data are in ./MAI/metrics/*
:
- Predictive Scores: We train a predictor on the synthetic data and do testing on the original data. Mean absolute value (MAE) on the original data is reported as the predictive score. (The lower, the better. )
- Discriminative Scores: We train a discriminator to tell synthetic data from the original data. Accuracy on the testing set is reported as the discriminative score. (The lower, the better. )
config_stock.json
configs for the stock dataset.
config_energy.json
configs for energy dataset.
config_sine.json
configs for sine dataset.
requirements.txt
stores all packages needed.
A experiment on Stock named AE0_EM0_RE50000
, for example, has a private folder ./MAI/storage/AE0_EM0_RE50000
for its own and there are three subfolders under it.
model
stores model related filespics
stores visualization for the evaluation of ExtraMAE by generation moderandom_once
synthesis
stores visualization for three other generation modes:cross_average
cross_concate
random_average
summary.ipynb
summarizes the results.
-
Create a conda environment named MAI.
conda create -n MAI python=3.6 conda activate MAI
-
Enter the folder of the repository MAI in the terminal.
-
Get your environment ready.
pip install -r requirements.txt
-
Run main.py with the config you need.
python main.py --config_dir=stock_config.json
python main.py --config_dir=energy_config.json
python main.py --config_dir=sine_config.json
-
In case you wanna change the configuration for different experiments and instances, just modify the config.json and save it.
-
To see the summarized results of predictive scores and discriminative scores, send the
experiment_name
to methodfind_results
inMAI/summary.ipynb
.