This repository contains code to reproduce the experiments in "Forecasting Hierarchical Time Series with a Regularized Embedding Space" from the 6th Workshop on Mining and Learning from Time Series at KDD '20.
The Australian travel flow data used in experiments can be downloaded here: https://robjhyndman.com/publications/hierarchical-tourism/.
Run the experiment.py
script with the following flags to reproduce experiments:
-
Initial Experiment:
-
python experiment.py reproduce --metrics_file='data/metrics/baseline.txt' --output_path='data/preds_baseline' --serialize_path='data/models_baseline' --reconciled_path='data/reconciled_preds_baseline'
-
in R:
reconcile_all(in_dir = 'preds_baseline', out_dir = 'reconciled_preds_baseline')
-
python experiment.py optimal_reconciliation --metrics_file='data/metrics/baseline.txt' --output_path='data/preds_baseline' --serialize_path='data/models_baseline' --reconciled_path='data/reconciled_preds_baseline'
-
-
Short Training Sequences:
-
python experiment.py reproduce --train_size=54 --metrics_file='data/metrics/small.txt' --output_path='data/preds_small' --serialize_path='data/models_small' --reconciled_path='data/reconciled_preds_small'
-
in R:
reconcile_all(in_dir = 'preds_small', out_dir = 'reconciled_preds_small')
-
python experiment.py optimal_reconciliation --train_size=54 --metrics_file='data/metrics/small.txt' --output_path='data/preds_small' --serialize_path='data/models_small' --reconciled_path='data/reconciled_preds_small'
-
-
Long Forecast Horizon:
-
python experiment.py reproduce --horizon=24 --metrics_file='data/metrics/horizon.txt' --output_path='data/preds_horizon' --serialize_path='data/models_horizon' --reconciled_path='data/reconciled_preds_horizon'
-
in R:
reconcile_all(in_dir = 'preds_horizon', out_dir = 'reconciled_preds_horizon', horizon = 24)
-
python experiment.py optimal_reconciliation --horizon=24 --metrics_file='data/metrics/horizon.txt' --output_path='data/preds_horizon' --serialize_path='data/models_horizon' --reconciled_path='data/reconciled_preds_horizon'
-
-
Relative Embedding Dimension: 0.5:
python experiment.py reproduce --embed_dim_ratio=0.5 --metrics_file='data/metrics/edim05.txt' --output_path='data/preds_edim05' --serialize_path='data/models_edim05' --reconciled_path='data/reconciled_preds_edim05'
-
Relative Embedding Dimension: 2:
python experiment.py reproduce --embed_dim_ratio=2 --metrics_file='data/metrics/edim2.txt' --output_path='data/preds_edim2' --serialize_path='data/models_edim2' --reconciled_path='data/reconciled_preds_edim2'
-
Relative Embedding Dimension: 4:
python experiment.py reproduce --embed_dim_ratio=4 --metrics_file='data/metrics/edim4.txt' --output_path='data/preds_edim4' --serialize_path='data/models_edim4' --reconciled_path='data/reconciled_preds_edim4'
Run the plot.py
script with the following flags to reproduce plots. Experiments must first be run and log data must be downloaded from tensorboard.
-
Initial Experiment:
python plot.py --fig_title='baseline'
-
Short Training Sequences:
python plot.py --fig_title='small'
-
Long Forecast Horizon:
python plot.py --fig_title='horizon'