Coherent Probabilistic Aggregate Queries on Long-horizon Forecasts

May 27, 2022 ยท View on GitHub

This is the code produced as part of the paper Coherent Probabilistic Aggregate Queries on Long-horizon Forecasts

Coherent Probabilistic Aggregate Queries on Long-horizon Forecasts.

Prathamesh Deshpande and Sunita Sarawagi. IJCAI 2022. arXiv:2111.03394v1.

Package Dependencies / Requirements

  • Python 3.7.9 (recommended).
  • All the requirements are specified in requirements.txt.

Run

./script.sh

How to work with Command Line Arguments?

  • If an optional argument is not passed, it's value will be extracted from configuration specified in the file main.py (based on dataset_name, model_name).
  • If a valid argument value is passed through command line arguments, the code will use it further. That is, it will ignore the value assigned in the configuration.

Command Line Arguments Information

Argument nameTypeValid AssignmentsDefault
dataset_namestrazure, ett, etthourly, Solar, taxi30min, Traffic911positional argument
saved_models_dirstr-None
output_dirstr-None
N_inputint>0-1
N_outputint>0-1
epochsint>0-1
normalizestrsame, zscore_per_series, gaussian_copula, logNone
learning_ratefloat>0-1.0
hidden_sizeint>0-1
num_grulstm_layersint>0-1
batch_sizeint>0-1
v_dimint>0-1
t2v_typestrlocal, idx, mdh_lincomb, mdh_partiNone
K_list[int,...,int ][>0,...,>0 ][]
devicestr-None

Datasets

All the datasets can be found here.

Add the dataset files/directories in data directory before running the code.

Output files

Targets and Forecasts

Following output files are stored in the <output_dir>/<dataset_name>/ directory.

File nameDescription
inputs.npyTest input values, size: number of time-series x N_input
targets.npyTest target/ground-truth values, size: number of time-series x N_output
<model_name>_pred_mu.npyMean forecast values. The size of the matrix is number of time-series x number of time-steps
<model_name>_pred_std.npyStandard-deviation of forecast values. The size of the matrix is number of time-series x number of time-steps

Metrics

All the evaluation metrics on test data are stored in <output_dir>/results_<dataset_name>.json in the following format:

{
  <model_name1>: 
    {
      'crps':<crps>,
      'mae':<mae>,
      'mse':<mse>,
      'smape':<smape>,
      'dtw':<dtw>,
      'tdi':<tdi>,
    }
  <model_name2>: 
    {
      'crps':<crps>,
      'mae':<mae>,
      'mse':<mse>,
      'smape':<smape>,
      'dtw':<dtw>,
      'tdi':<tdi>,
    }
    .
    .
    .
}

Here <model_name1>, <model_name2>, ... are different models under consideration.