This project is my capstone project for Udacity's Data Scientist Nanodegree Program.
We will implement two machine learning algorithms (Moving Average and LSTM) to predict future stock price of a company. Then we choose the best out of the two algorithms to develop our own stock price predictor.
This project includes Python scripts where trader can input historical stock price data to get a trained LSTM model. The trained model can then be used to predict future stock price.
Blog post accompanying this project
https://medium.com/ai-in-plain-english/how-i-create-my-stock-price-predictor-f38c229b758e
Stock Price Prediction.ipynb - Jupyter Notebook used for stock price prediction.
train.py - Python script to loan historical stock price data and train a LSTM model.
predictor.py - Python script to loan historical stock price data and future predict stock price.
EOD-INTC.csv - historical stock price data for Intel Inc from Quandl.
model.pkl - trained LSTM model in pickle file.
scaler.gz - data scaler object saved in archive file (for use in predictor.py).
sys, pandas, numpy, sklearn, keras, pickle, joblib, matplotlib
- Run the following command in the project's root directory to load historial stock price data and output a trained LSTM model and data scaler object file.
- python train.py < historical stock price in CSV filepath > < output model filepath in .pkl > < output data scaler object filepath in .gz > < test size ratio > < training time frame (days) > < offset for training data; if unsure, use training time frame >
python train.py data/EOD-INTC.csv model/model.pkl model/scaler.gz 0.2 60 60
- python train.py < historical stock price in CSV filepath > < output model filepath in .pkl > < output data scaler object filepath in .gz > < test size ratio > < training time frame (days) > < offset for training data; if unsure, use training time frame >
- Run the following command in the project's root directory to load model pickle file, data scaler object file and historical stock price. The predicted price will be shown.
- python predictor.py < model filepath > < data scaler object filepath > < historical stock price in CSV filepath >
python predictor.py model/model.pkl model/scaler.gz data/EOD-INTC.csv
- python predictor.py < model filepath > < data scaler object filepath > < historical stock price in CSV filepath >
Udacity for providing an excellent Data Scientist training program.