Skip to content

A suite of machine learning algorithms that predict the next closing price of a stock based on the stock's previous 50 closing prices.

Notifications You must be signed in to change notification settings

ryankortbeek/stock-price-predictor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

stock-price-predictor

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.

Disclaimer

  • 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

Implemented Machine Learning Algorithms

  1. Linear regression (LR)
    • implemented from scratch
  2. Long short-term memory (LSTM)
    • implemented using TensorFlow Keras
    • recurrent artificial neural network
    • one lstm layer
  3. Multi-layer perceptron (MLP)
    • implemented from scratch
    • fully connected feed-forward artificial neural network
    • one input layer
    • one hidden layer
    • one output layer

Results

LR

The results of the trained LR model on the test data can be seen in the image below.

LSTM

The results of the trained LSTM model on the test data can be seen in the image below.

MLP

The results of the trained MLP model on the test data can be seen in the image below.

Dataset

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.

Loss Function

The loss function used in the implementation of all the models was mean squared error.

Evaluation Metric

The metric used to evaluate all the models was mean absolute difference.

Running Instructions

Ensure the following dependencies are installed.

  • pandas
  • numpy
  • tensorflow
  • matplotlib

Train and test the models with:

python3 main.py

About

A suite of machine learning algorithms that predict the next closing price of a stock based on the stock's previous 50 closing prices.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages