This repo contains the code to reproduce the result in the paper:
Petrel: Personalized Trend Line Estimation with Limited Labels from One Individual published in PAKDD 2023.
Petrel generates customized trend lines that consider user preferences and input time series shapes. Petrel obtains users' preferred trends by asking users to draw trend lines on limited sample trends.
Tested under Python 3.8.13 in Ubuntu.
Install the required packages by
conda env create -f environment.yaml
conda activate env_tykuo
Data Folder Link: https://drive.google.com/file/d/1bc2A4OKITtgTyA1ZDQAnTYl2NLcE7nDC/view?usp=sharing
- A4Benchmark: YahooS5 A4 Dataset csv file
- A4Benchmark_SimulateUser: Generate simulate User
- Done_s2_img_user: The pictures that model predict with differnt user
- Done_user: The user data json file and pictures that user draw.
- mixer_multiple_full: Generate simulate user by GenerateSimulateUser.py
- trend: original time series dataset which include value, L1 Trend Filtering, HP Filtering, STL trend.
project
│ README.md
│ evvironment.yaml
│ pretraincnn_model
│ pretrainfc_model
│ pretraintransformer_model
│ pretrainlstm_model
│ OurMethod_model
│
│
└───A4Benchmark_SimulateUser
│ │ A4Benchmark-TS1.csv
│ │ A4Benchmark-TS2.csv
│
└───A4Benchmark
│ │ A4Benchmark-TS1.csv
│ │ A4Benchmark-TS2.csv
│
└-───Trend
│ │ file1.json
│ │ file2.json
│ │ file3.json
│
└───mixer_multiple_full
│
└───user29(User who you want to check)
│ │ file1.pdf
│ │ file2.pdf
│ │ user29.json(User draw data)
│
│
└───s2_img_user29(User who you want to check)
│ file1.pdf
│ file2.pdf
│ user29.json(User draw data)
To store model output pictures
mkdir mixer_multiple_full
mkdir s2_img_user29
cd s2_img_user29
mkdir 1_v2 8_v2 12_v2 20_v2 21_v2 66 74 81 88 91
You need to run this code to generate simulate users' data before you run Pretrain model code and OurMethod code.
python GenerateSimulateUser.py
python CNN.py --epoch 3 --lr 0.01 --batch 10 --user 29
python LSTM.py --epoch 3 --lr 0.01 --batch 10 --user 29
python Transformer.py --epoch 3 --lr 0.01 --batch 10 --user 29
python PretrainCNN_train.py --epoch 1 --lr 0.01 --batch 1000
python PretrainCNN_finetune_test.py --epoch 3 --lr 0.01 --batch 10 --user 29
python PretrainLSTM_train.py --epoch 1 --lr 0.01 --batch 1000
python PretrainLSTM_finetune_test.py --epoch 3 --lr 0.01 --batch 10 --user 29
python PretrainFullyConnected_train.py --epoch 1 --lr 0.01 --batch 1000
python PretrainFullyConnected_finetune_test.py --epoch 3 --lr 0.01 --batch 10 --user 29
python PretrainTransformer_train.py --epoch 1 --lr 0.01 --batch 1000
python PretrainTransformer_finetune_test.py --epoch 3 --lr 0.01 --batch 10 --user 29
python OurMethod_train.py --epoch 1 --lr 0.01 --batch 1000
python OurMethod_test.py
python l1hpstl.py
Please cite our work if you find Petrel useful in your research.
@inproceedings{
kuo2023petrel,
title={Petrel: Personalized Trend Line Estimation with Limited Labels from One Individual},
author={Tong-Yi Kuo and Hung-Hsuan Chen},
booktitle={The 27th Pacific-Asia Conference on Knowledge Discovery and Data Mining},
year={2023}
}