Long Short-Term Memory Recurrent Neural Network for prediction of Nifty50 index from historical data
This project aims to predict the next day's stock prices based on historical data from the Nifty 50 index using Long Short-Term Memory (LSTM) neural networks. The model is built using TensorFlow and Keras to predict stock prices, leveraging time-series data for training and testing. This app is deployed on streamlit platform and can be used for testing or predicting the Nifty50 future open, close, %change in price.
The goal of this project is to use machine learning techniques, specifically LSTM (a type of Recurrent Neural Network), to predict stock prices for the Nifty 50 index. The model uses historical stock data to make predictions on future stock prices, which can be useful for investors and analysts.
The data used in this project is from the Nifty 50 index. The preprocessing steps include:
- Downloading the historical stock price data.
- Normalizing the data using MinMaxScaler.
- Splitting the data into training and testing sets.
- Model Architecture
- The LSTM model is built with the following architecture:
- Input Layer: Takes in the preprocessed stock price data.
- LSTM Layer: The core of the model, where the sequential data is processed.
- Dense Layer: A fully connected layer that outputs the predicted stock price.
- Training the Model
- Once the data is preprocessed, the LSTM model is trained using the training dataset. The model is then evaluated using the testing dataset.
After training, the model can be used to make predictions on the next day's stock price.
- predicted_price = model.predict(input_data)
- Streamlit app for prediction
The performance of the model can be evaluated using metrics such as Mean Absolute Error (MAE) or Root Mean Squared Error (RMSE). A graph of the predicted vs. actual stock prices can be plotted to visualize the model's performance.