A suite of machine learning algorithms trained on historical data corresponding to the Apple stock (ticker: AAPL). Each model "analyzes" the previous 50 closing prices of a stock and predicts the next closing price.
- Predictions made by the machine learning algorithms implemented in this repository are not guaranteed to be accurate, truthful, or correct whatsoever
- Predictions should not be considered or used when making any financial decision
- Predictions are not intended to act as financial advice in any means
- Linear regression (LR)
- implemented from scratch
- Long short-term memory (LSTM)
- implemented using TensorFlow Keras
- recurrent artificial neural network
- one lstm layer
- Multi-layer perceptron (MLP)
- implemented from scratch
- fully connected feed-forward artificial neural network
- one input layer
- one hidden layer
- one output layer
The results of the trained LR model on the test data can be seen in the image below.
The results of the trained LSTM model on the test data can be seen in the image below.
The results of the trained MLP model on the test data can be seen in the image below.
The dataset used for training, validation, and testing was retreived from Yahoo Finance via the Yahoo Finance Python Package.
See here for how this is done.
The loss function used in the implementation of all the models was mean squared error.
The metric used to evaluate all the models was mean absolute difference.
Ensure the following dependencies are installed.
- pandas
- numpy
- tensorflow
- matplotlib
Train and test the models with:
python3 main.py