time-series-forecasting & anomaly_detection
git clone https://github.com/KNUAI/forCar.git
cd forCar && pip install -r requirements.txt
If you want to forecaste, put your data in datasets/forecasting/
If you want to sample data for forecasting, you can download this ETDataset
ex)
If you want to anomaly detection, put your data in datasets/Anomaly_Detection/
If you want to sample data for anomaly detection, you can download this ST-AWFD
ex)
Notice
anomaly detection dataset must have 'MaterialID', 'is_test', 'target' columns
If you want to train and test forecasting at once
python forecasting.py --model SCINet --data ETTh1.csv --cols HUFL HULL MUFL MULL LUFL LULL OT --seq_len 96 --pred_len 48
If you want to train forecasting
python forecasting_train.py --model SCINet --data ETTh1.csv --cols HUFL HULL MUFL MULL LUFL LULL OT --seq_len 96 --pred_len 48
If you want to test forecasting
python forecasting_test.py --model SCINet --data ETTh1.csv --cols HUFL HULL MUFL MULL LUFL LULL OT --seq_len 96 --pred_len 48
Write the model you want to use in model!
Write the file_name you want to use in data!
Write the variables you want to use in cols!
Write the length you want to input in seq_len!
Write the length you want to predict in pred_len!
If you want to train and test anomaly detection at once
python FD.py --data D1.csv --cols feature_1 feature_2 feature_3 feature_4 feature_5 feature_6 feature_7 feature_8 feature_9 feature_10 feature_11 feature_12 feature_13 feature_14 feature_15
If you want to train anomaly detection
python FD_train.py --data D1.csv --cols feature_1 feature_2 feature_3 feature_4 feature_5 feature_6 feature_7 feature_8 feature_9 feature_10 feature_11 feature_12 feature_13 feature_14 feature_15
If you want to test anomaly detection
python FD_test.py --data D1.csv --cols feature_1 feature_2 feature_3 feature_4 feature_5 feature_6 feature_7 feature_8 feature_9 feature_10 feature_11 feature_12 feature_13 feature_14 feature_15
Write the file_name you want to use in data!
Write the variables you want to use in cols!
The detailed descriptions for forecasting
Parameter name | Description of parameter |
---|---|
model | The model of experiment. This can be set to SCINet , Informer , LSTM |
data | The data_file_name |
inverse | Whether to inverse output data, using this argument means inversing output data (defaults to True ) |
gpu | The gpu no, used for training and inference (defaults to 0) |
seq_len | Input sequence length of Informer encoder (defaults to 96) |
pred_len | Prediction sequence length (defaults to 48) |
cols | Certain cols from the data files as the input features |
train_epochs | Train epochs (defaults to 100) |
batch_size | The batch size of training input data (defaults to 32) |
patience | Early stopping patience (defaults to 5) |
learning_rate | Optimizer learning rate (defaults to 0.0001) |
loss | Loss function: mse , mae (defaults to mae ) |
lradj | Ways to adjust the learning rate (defaults to type1 ) |
evaluate | Evaluate the trained model |
hidden_size | N_channel of module (defaults to 4) |
kernel | Window_size: 3, 5, 7 (defaults to 5) |
dropout | Dropout (defaults to 0.5) |
num_decoder_layer | Evaluate the trained model (defaults to 1) |
The detailed descriptions for anomaly detection
Parameter name | Description of parameter |
---|---|
data | The data_file_name |
cols | Certain cols from the data files as the input features |
fold | 5-fold: 1, 2, 3, 4, 5 (defaults to 5) |
latent_size | Dimension of latent vector (defaults to 128) |
threshold_rate | Threshold_rate (defaults to 5) |
n_layer | n_layers of rnn model (defaults to 1) |
epoch | Train epochs (defaults to 200) |
batch_size | The batch size of training input data (defaults to 32) |
lr | Optimizer learning rate (defaults to 0.0001) |
r_model | RNN model: LSTM , GRU (defaults to LSTM ) |
evaluate | Evaluate the trained model |
patience | Early stopping patience (defaults to 3) |
gpus | The gpu no, used for training and inference (defaults to 0) |
If you finish the experiment, you can see experiment results in picture directory