Skip to content

The official source code for Linear-Layer-Enhanced Quantum Long Short-Term Memory (Quantum LSTM) for Carbon Price Forecasting.

Notifications You must be signed in to change notification settings

TravisCao/Quantum-LSTM

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Linear-Layer-Enhanced Quantum Long Short-Term Memory for Carbon Price Forcasting

The official source code for Linear-Layer-Enhanced Quantum Long Short-Term Memory for Carbon Price Forecasting, accepted at Quantum Machine Intelligence (July 2023).

This code implements the quantum LSTM for price forecasting problems. By changing the data, you can also execute it for other kinds of forecasting or regression problems.

Cite the paper

@article{cao2023linear,
  title={Linear-layer-enhanced quantum long short-term memory for carbon price forecasting},
  author={Cao, Yuji and Zhou, Xiyuan and Fei, Xiang and Zhao, Huan and Liu, Wenxuan and Zhao, Junhua},
  journal={Quantum Machine Intelligence},
  volume={5},
  number={2},
  pages={26},
  year={2023},
  publisher={Springer}
}

Dependencies

python == 3.8

Use requirements.txt to install the dependencies for reproducing the code.

pip install -r requirement.txt

The experimental result is stored by WandB. You need to register your account first. See the quickstart of WandB here.

Executing program

  • src/train.py is the main entry for training different models.
  • config.yaml sets the configuration of data, model and training pipelines.
  • data_utils.py contains data modules of the dataset including data preprocessing etc.
  • utils.py includes utility functions.
  • models/qlstm.py and models/xx_qlstm.py implement the quantum-classical models.
# train QLSTM
python src/train.py --batch_size 16 --model_name QLSTM --devices 16 --accelerator cpu --n_qubits 4 
# train L-QLSTM
python src/train.py --batch_size 16 --model_name xx-QLSTM --devices 16 --accelerator cpu --n_qubits 4 
# train LSTM
python src/run_lstm.py --seed 1 --data period2 --hidden_dim 3 

Data

This is the dataset of EU carbon market from 2014.01.01 to 2020.12.31.

Column Names

  • Price: carbon price
  • High: highest price
  • Low: lowest price
  • Open: opening price
  • Vol: trading volume
  • Week: week number of the year
  • Year: year of the day
  • t: remaining days to the last open day of the year

CSV files

x_3d.csv contains features of last day, day before last day, and weekday of last week.

x_5d.csv contains features of last five days.

Period

period1 contains data during 2014.01.01 - 2016.12.31.

period2 contains data from 2017.01.01 - 2020.12.31.

Help

If you have any questions or need further clarification, please feel free to reach out to me at travisyjcao@gmail.com.

About

The official source code for Linear-Layer-Enhanced Quantum Long Short-Term Memory (Quantum LSTM) for Carbon Price Forecasting.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published