Skip to content

About

A machine learning pipeline utilizing variance reduction and Laplace smoothing to forecast IPL T20 cricket match margins.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

4 Commits

Folders and files

Repository files navigation

AIPL Match Prediction Model

Hi, I'm Ashish Thorat, a 2nd-year B.Tech Computer Science student at A. C. Patil College of Engineering and a learner at NxtWave. This repository documents the machine learning pipeline I developed for the NxtWave AIPL Match Prediction competition.

Project Objective

The challenge was to predict the specific margin of victory for upcoming IPL matches across four classes:

  • A_small / A_big (Team A wins by a small/large margin)
  • B_small / B_big (Team B wins by a small/large margin)

The evaluation metric was Multi-Class Log Loss. This is a critical factor because Log Loss heavily penalizes models that are highly confident but ultimately incorrect.

Core Strategy: Variance Reduction

T20 cricket is inherently chaotic; a single dropped catch or rain delay can completely flip a match. Early in my research, I realized that building an overly complex model to chase high scores on the Public Leaderboard was a trap. Predicting a volatile sport with extreme confidence almost always leads to massive Log Loss penalties on unseen future data.

Rather than building an aggressive decision tree, my entire approach focused on variance reduction and defensive modeling.

Technical Implementation

Here is how I mathematically protected the model from overfitting to noise:

1. Laplace Smoothing for Small Samples

While exploring the data, I encountered a statistical trap: if a team plays exactly one match at a specific venue and wins, raw math gives them a 100% win rate. Feeding this to a model causes dangerous overconfidence. To fix this, I applied Laplace Smoothing ($\alpha=10$) to pull these small-sample outliers closer to the 50% global average, establishing a much safer baseline.

2. A Constrained CatBoost Ensemble

I utilized a 10-Fold Stratified CatBoost Classifier because it natively handles categorical features (like team names and venues) very efficiently. However, I deliberately restricted its learning capacity:

  • Depth = 2: Keeping the trees shallow forces the model to only learn undeniable, high-level trends rather than memorizing random match noise.
  • L2 Regularization = 30: A severe penalty was applied to the leaf nodes to prevent the algorithm from ever outputting an overconfident prediction.

3. The 80/20 Prior Anchor

To absolutely guarantee the Log Loss score wouldn't explode during the Private Leaderboard evaluation, I calculated the exact historical base rate of the target classes across the entire dataset. During the final inference step, the script mathematically anchors the predictions—forcing them to be 80% based on the historical baseline, and only allowing the CatBoost model to shift the final probability by a maximum of 20%.

4. Handling the "Unknown Toss" for Future Matches

For historical matches, we know which team batted first. But for future IPL fixtures, the coin toss hasn't happened yet. To handle this missing variable without dropping the feature entirely, my script simulates both scenarios: it runs the prediction assuming Team A bats first, runs it again assuming Team B bats first, and mathematically averages the two probability distributions.

Repository Structure

  • /data/: Contains the official competition CSV datasets (train_IPL.csv, public_lb_matches.csv, schedule.csv).
  • AIPL_mark6.ipynb: The fully documented Jupyter Notebook containing the end-to-end pipeline (Data Cleaning → Laplace Smoothing → Training → Prior Anchoring → Output).
  • submission_mark6.csv: The final probability matrix generated by the model.
  • requirements.txt: Required Python dependencies.

How to Run Locally

  1. Clone this repository to your local machine.
  2. Install the required libraries: pip install -r requirements.txt
  3. Ensure the datasets are placed inside the /data/ folder.
  4. Open AIPL_mark6.ipynb and execute the cells sequentially.

About

A machine learning pipeline utilizing variance reduction and Laplace smoothing to forecast IPL T20 cricket match margins.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages