Time-series stock price forecasting using Random Forest, LSTM (Deep Learning), and ARIMA on IBM historical stock data.
This project applies three distinct forecasting approaches to IBM stock price data, comparing their predictive power on closing prices:
- Random Forest Regressor — ensemble tree-based approach
- LSTM Neural Network — 4-layer stacked LSTM with Dropout regularisation
- ARIMA / Auto-ARIMA — classical time-series decomposition and forecasting
MNC-Stock-Market-Price-Prediction/
├── MNC_Stock_Market_Price_Prediction.ipynb # Full analysis and modelling notebook
├── mnc_stock_market_price_prediction.py # Python script version
├── IBM Stock Data.csv # Historical IBM stock data (OHLCV)
├── requirements.txt # Python dependencies
└── README.md # This file
| Feature | Description |
|---|---|
| Date | Trading date |
| Open | Opening price (USD) |
| High | Intraday high price (USD) |
| Low | Intraday low price (USD) |
| Close | Closing price (USD) — target variable |
| Volume | Number of shares traded |
| Name | Ticker symbol (IBM) |
- 100 decision trees with bootstrap aggregation
- Features: lag prices, rolling mean, rolling std
- Evaluated on 20% holdout set
Layer 1: LSTM(50, return_sequences=True) + Dropout(0.2)
Layer 2: LSTM(50, return_sequences=True) + Dropout(0.2)
Layer 3: LSTM(50, return_sequences=True) + Dropout(0.2)
Layer 4: LSTM(50) + Dropout(0.2)
Output: Dense(1)
- Optimizer: Adam | Loss: Mean Squared Error
- Look-back window: 60 days
- Augmented Dickey-Fuller (ADF) test for stationarity
- Seasonal decomposition (trend, seasonal, residual)
- Auto-ARIMA for optimal (p, d, q) selection
| Model | RMSE |
|---|---|
| Random Forest | ~4.2 |
| LSTM | ~3.1 |
| ARIMA | ~5.8 |
LSTM achieves the lowest RMSE, capturing long-term temporal dependencies in the stock price sequence.
- Add Bidirectional LSTM and GRU variants
- Incorporate sentiment analysis from financial news (NLP)
- Multi-stock portfolio prediction
- Real-time prediction dashboard with Streamlit
- Add technical indicators: RSI, MACD, Bollinger Bands
pip install -r requirements.txt
jupyter notebook MNC_Stock_Market_Price_Prediction.ipynbDevyani Deore — github.com/DevyaniD19
MIT License — see LICENSE for details.