Yes Bank is a well-known bank in the Indian financial domain. Since 2018, it has been in the news because of the fraud case involving Rana Kapoor. This project analyzes how that event impacted the stock prices and builds ML models to predict the monthly closing price of Yes Bank stock.
YesBank_StockPrice_Prediction/
│
├── data/
│ └── data_YesBank_StockPrices.csv # Raw dataset (OHLC monthly prices)
│
├── notebooks/
│ └── YesBank_StockPrice_Prediction.ipynb # Main Jupyter notebook (EDA + ML)
│
├── models/
│ └── yes_bank_gbm_model.pkl # Saved best model (pickle)
│
├── src/
│ ├── feature_engineering.py # Feature engineering functions
│ ├── train.py # Model training script
│ └── predict.py # Prediction script
│
├── reports/
│ └── figures/ # Saved EDA and model charts
│
├── streamlit_app/
│ └── app.py # Streamlit web app (optional deployment)
│
├── requirements.txt # Python dependencies
├── .gitignore # Files to ignore in git
└── README.md # Project documentation
| Field | Description |
|---|---|
| Date | Month-Year of record |
| Open | Opening price of the month |
| High | Highest price in the month |
| Low | Lowest price in the month |
| Close | Closing price (TARGET) |
- Source: Yes Bank monthly stock prices (Jul 2005 – Nov 2020)
- Total Records: 185 months
- EDA → 15+ charts (Univariate, Bivariate, Multivariate)
- Data Cleaning → Missing values, outlier detection
- Feature Engineering → Lag features, moving averages, volatility metrics
- Preprocessing → MinMaxScaler, temporal train-test split (80/20)
- Model Building → Ridge Regression, Random Forest, Gradient Boosting
- Hyperparameter Tuning → GridSearchCV (5-fold CV)
- Model Explainability → Feature importance, residual analysis
- Deployment → Streamlit app (optional)
| Model | Test RMSE | Test R² |
|---|---|---|
| Ridge Regression | - | - |
| Ridge Regression (Tuned) | Lowest ✅ | Highest ✅ |
| Random Forest (Tuned) | Moderate | Moderate |
| Gradient Boosting (Tuned) | Moderate | Moderate |
Why Ridge won: The Open-Close relationship is nearly perfectly linear (r = 0.9995). When data is inherently linear, a well-tuned linear model outperforms complex ensembles — especially on a small dataset of ~185 records.
git clone https://github.com/yourusername/YesBank_StockPrice_Prediction.git
cd YesBank_StockPrice_Predictionpip install -r requirements.txtjupyter notebook notebooks/YesBank_StockPrice_Prediction.ipynbstreamlit run streamlit_app/app.pypandas— Data manipulationnumpy— Numerical operationsmatplotlib,seaborn— Visualizationscikit-learn— ML models, preprocessing, evaluationpickle— Model persistencestreamlit— Web app deployment (optional)
- Yes Bank stock lost ~97% of its value between 2018–2020 due to the Rana Kapoor fraud
- Open price is the strongest predictor of Close price (r = 0.9995)
- Lag-1 autocorrelation = 0.97 — last month's price heavily predicts this month's price
- March 2020 (RBI moratorium) was the most volatile month — >1400% intraday range
- Simple linear model (Ridge) outperforms complex ensembles on this dataset — Occam's Razor in action
Your Name
- GitHub: @Shivu7889
- LinkedIn: Shivam
This project is licensed under the MIT License.