(For simplified demo on Google Colab, save "APS490" folder to your Google Drive or view it here: https://drive.google.com/file/d/1FwafCGFpnnft0bUER9L9gcMgOXJAw_sW/view?usp=sharing).
a. Install Miniconda:
(Linux OS; installation in another os could be found in the link above)
curl 'https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh' > Miniconda.sh
bash Miniconda.sh
rm Miniconda.sh
b. Close and re-open your terminal session.
c. Change directories (cd
) to where you cloned this repository.
d. Initialize conda
$ conda init
$ conda env create -f environment.yml
$ conda activate aps490
$ python -m predection.main train
Keyword arguments:
data_root
: training dataset directory root. Default: ./prediction/datasets/train/
output_root
: output directory root. Default: ./output/
seed
: random seed. Default: 42
seq_length
: squence length of the sliding window. Default: 48
pred_length
: prediction length of the sliding window. Default: 24
epoch_num
: number of epochs. Default: 1000
learning_rate
: learning rate of the adam optimizer. Default: 0.0008
hidden_size
: hidden_size of RNN . Default: 7
num_layers
: num_layers of RNN. Default: 1
loss
: training loss function. (mae
, mse
, or huber_<delta>
) Default: huber_0.022
model
: RNN model type (lstm
or gru
). Default: gru
Example:
$ python -m prediction.main train --output_root=./output/
$ streamlit run train_app.py
You may use the following command to train the model.
$ python -m prediction.main validate --output_root=<output directory root> --checkpoint_path=<checkpoint path>
Keyword arguments:
checkpoint_path
: path to the model that will be evaulatedoutput_root
: the output directory root. Default: ./output/
data_root
: validation dataset directory root. Default: ./prediction/datasets/valid/
seed
: random seed. Default: 42
seq_length
: squence length of the sliding window. Default: 48
pred_length
: prediction length of the sliding window. Default: 24
Example:
$ python -m prediction.main validate --output_root=./output/ --checkpoint_path=./output/model.pth
Visualize the prediction and anomaly analysis
$ streamlit run stream_app.py