Notes: I'm planning to work on an extension of this project. Consider this a foundation building project.
The task of predicting stock market prices is challenging. Stock prediction is of interest to most investors due to its high volatility. Even now, some investors use a combination of technical and fundamental analysis to help them make better decisions about their equity market investments. A newly popular method many investors have been using is artificial networks. Therefore, this project aims to find out which ANN model has the best performance.
This is an academic project for ST311. The updated dataset for this project can be found here. This code was last run on 3rd May 2022 with this version of the dataset.
- Make sure you have the following packages: Pytorch, Pandas, NumPy, d2l, scikit-learn, math, matplotlib, Seaborn
- Run the code (All the code was run on CPU but use GPU if you wish)
- Bigger sliding window for longer-term data
- Predictions for more number of days (e.g. one month's worth of predictions instead of one)
- Need to experiment with more ANN structures (e.g. hidden layers, combinations of concepts, types of layers)
- A more complex model including external factors apart from prices alone (could use live news)
I found that I had control over various variables for each model. But what I decided to adjust was the number of epochs, number of neurons in the hidden layer, learning rates, window size, and dropout probability. It was challenging to make a comparison given the differences in the models. The prediction vs actual prices plots indicated that all our models performed well apart from the second MLP model. But by using RMSE to judge the accuracy, I concluded that the LSTM model outperformed the RNN model while the RNN model outperformed the MLP model. However, I understand how the results may be completely different if I tried the same models on different datasets, or changed up the structures slightly.
- Linear regression vs ANN in stock prediction - part 1
- Linear regression vs ANN in stock prediction - part 2
- Deep learning - part 1
- Deep learning - part 2
- Deep learning - part 3
- Neural networks
- Activation functions
- Activation functions study
- Activation functions list
- Saddle point problem
- Weight initializations
- Inheriting classes
- Dataloaders in Pytorch
- Normalising data - part 1
- Normalising data - part 2
- Measuring accuracy
- MLP model building
- Hidden layer structures
- MLP in stock prediction prices - part 1
- MLP in stock prediction - part 2
- MLP in short-term predictions
- Sliding window method - part 1
- Sliding window method - part 2
- Recurrent neural networks introduction
- RNN models in prediction
- Pytorch RNN implementation - part 1
- Pytorch RNN implementation - part 2
- RNN back propagation
- RNNs and the vanishing gradient problem - part 1
- RNN and the vanishing gradient - part 2
- RNN and LSTM concepts
- LSTM applications
- LSTM concepts - part 1
- LSTM concepts - part 2
- LSTM concepts - part 3
- LSTM units
- LSTM and GRU concepts
- Pytorch LSTM implementation