Model for univariate time series single-step forecasting and anomaly detection.
- Python==3.9.0
- numpy==1.26.3
- pandas==2.1.4
- scikit_learn==1.4.1
- scipy==1.11.4
- matplotlib==3.7.5
- torch==2.1.1
- data_provider: Dataset preprocessing
- logs: Log directory, storing result logs of each dataset
- util: Utility library
- index.py: Calculate the position of the most similar historical subsequence to the current subsequence
- tools.py: Anomaly label adjustment, plotting, rolling calculation of subsequence mean and variance
- models: Models of different Methods
- layers: Layers that execute the model
- scripts: Executable files directory
- exp: Main files directory
-
Dataset
- Place all datasets in the same directory, such as the
./dataset/
directory - The organization of each dataset file is as follows:
- KPI
- train/*.csv
- test/*.csv
- The same name sequence in the train and test directories corresponds to the same sequence, and the sequence consists of timestamp, value, label
- Yahoo
- real/*.csv
- synthetic/*.csv
- A3/*.csv
- A4/*.csv
- MSLU: As it is part of the NASA MSL dataset, it can be directly accessed from the NASA dataset
- train/*.npy Storing training set sequences
- test/*.npy Storing test set sequences
- test_label/*.csv Storing corresponding label data
- NAB
- *.csv Directly place the corresponding sequence data
- KPI
- Place all datasets in the same directory, such as the
-
Adapt the environment with
requirement.txt
:pip install -r requirement.txt
-
Run the executable files in the corresponding executable files directory to start the algorithm.
You can run the following command to perform single-step forecasting or anomaly detection on the sequences in the corresponding dataset:
sh ./scripts/PatchLinear/Yahoo.sh
The settable parameters are explained in the run_longExp.py
file.
We appreciate the following github repo very much for the valuable code base and datasets:
https://github.com/cure-lab/LTSF-Linear
https://github.com/yuqinie98/PatchTST/
https://github.com/ts-kim/RevIN
If you have any questions or concerns, please contact me: zhengmh1229@stu.xmu.edu.cn or submit an issue