NIFTY 50 Closing Price Prediction Using Long Short-Term Memory (LSTM)
Problem Statement
Develop an LSTM-based time-series forecasting model to predict the next trading day's NIFTY 50 closing price using historical closing-price data. The model should learn temporal patterns from previous trading days and evaluate its forecasting performance using suitable regression metrics.
Dataset Name
NIFTY 50 – 25 Years Historical Data (1999–2026)
Dataset Description
The dataset contains historical daily NIFTY 50 market data from 1999 to 2026.
| Attribute | Description |
|---|---|
| Date | Trading date |
| Open | Opening value of NIFTY 50 |
| High | Highest value during the trading day |
| Low | Lowest value during the trading day |
| Close | Closing value of NIFTY 50 |
| Volume | Total trading volume |
For this practical, Close will be the primary variable used for prediction.
Tasks to be Performed
- Load and explore the NIFTY 50 dataset.
- Check data types, missing values, and duplicate records.
-
Convert
Dateinto datetime format and arrange records chronologically. - Visualize the historical NIFTY 50 closing-price trend.
-
Select and normalize the
Closevalues using MinMaxScaler. - Create time-series sequences using the previous 30 trading days to predict the next trading day's closing price.
- Split the sequences chronologically into 80% training and 20% testing data.
- Reshape the data into the 3D format required by LSTM.
- Build and train an LSTM model.
- Plot training and validation loss.
- Predict NIFTY 50 closing prices on the test data.
- Convert predictions back to the original scale.
- Evaluate the model using MAE and RMSE.
- Plot Actual vs Predicted Closing Price and interpret the results.
0 टिप्पण्या
कृपया तुमच्या प्रियजनांना लेख शेअर करा आणि तुमचा अभिप्राय जरूर नोंदवा. 🙏 🙏