-
First run
python3 load_data.py
to download the necessary dataset from Yahoo Finance. Please navigate to/experiments/
to see sample EDA of the downloaded dataset. -
Run
python3 main.py
to train all LSTM models considered:- Base LSTM
- Stacked (3 models) LSTM
- Ensemble (bagged 5 models) LSTM
- LSTM with Attention Layer
The trained model weights and loss information will be saved in
/saved_models/
. To load and test the models, runpython3 predict.py
.
An example base LSTM output is shown here for 18 stocks:
The model architectures are visualized below:
Finally, the general runtime for training 500 epochs are shown below:
Derivations, statistical testing, and more information can be found from the write-up.