How (NOT) To Predict Stock Prices With LSTMs
- Not so recently, a brilliant and ‘original’ idea suddenly struck me — what if I could predict stock prices using Machine Learning.
- The following piece of code downloads stock price data for Reliance over 15 years with a resolution of 1 day and stores it in a pandas dataframe.
- Let’s fix our problem statement now — the LSTM model shall see the close prices for the last 10 days (called the time_step) and predict the close price for the next day.
- But in a practical scenario, the test data will be in real-time, so you won’t know the minimum or maximum or average values beforehand!
- Finally, let’s structure the data so that our LSTM model can easily read them.
- The simple sequential model has an LSTM layer followed by a dropout (to reduce over-fitting) and a final dense layer (our output prediction).
Top 200 comments