NIFTY 50 Closing Price Prediction Using Long Short-Term Memory (LSTM)

 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.

AttributeDescription
DateTrading date
OpenOpening value of NIFTY 50
HighHighest value during the trading day
LowLowest value during the trading day
CloseClosing value of NIFTY 50
VolumeTotal trading volume

For this practical, Close will be the primary variable used for prediction.

Tasks to be Performed

  1. Load and explore the NIFTY 50 dataset.
  2. Check data types, missing values, and duplicate records.
  3. Convert Date into datetime format and arrange records chronologically.
  4. Visualize the historical NIFTY 50 closing-price trend.
  5. Select and normalize the Close values using MinMaxScaler.
  6. Create time-series sequences using the previous 30 trading days to predict the next trading day's closing price.
  7. Split the sequences chronologically into 80% training and 20% testing data.
  8. Reshape the data into the 3D format required by LSTM.
  9. Build and train an LSTM model.
  10. Plot training and validation loss.
  11. Predict NIFTY 50 closing prices on the test data.
  12. Convert predictions back to the original scale.
  13. Evaluate the model using MAE and RMSE.
  14. Plot Actual vs Predicted Closing Price and interpret the results.

टिप्पणी पोस्ट करा

0 टिप्पण्या