Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

IPL Cricket Analysis and Prediction System

An end-to-end data science project analyzing 17 years of IPL cricket data (2008–2024) to uncover team and player performance patterns, and to predict match outcomes using machine learning.

Dataset

  • Source: IPL Complete Dataset (2008–2024) by patrickb1912 on Kaggle
  • Files used: matches.csv (1,095 matches) and deliveries.csv (260,920 ball-by-ball records)
  • Not included in this repo due to size — download from the Kaggle link above and place both CSVs in a data/ folder before running.

Methodology

Data Preprocessing

  • Handled missing values contextually (e.g., no-result matches filled with "No Result", missing D/L method filled with "Standard")
  • Standardized historically renamed team names (e.g., Delhi Daredevils → Delhi Capitals, Kings XI Punjab → Punjab Kings) across both datasets
  • Verified data integrity with automated tests (tests.py)

Exploratory Data Analysis

Performed using Pandas, NumPy, Matplotlib, and Seaborn to uncover:

  • Season-wise match trends
  • Toss impact on match outcomes
  • Top run-scorers and wicket-takers
  • Orange Cap and Purple Cap winners by season
  • Super Over match history
  • High-scoring match trends
  • Umpire officiating frequency

Predictive Modeling

  • Target: Whether team1 wins the match (binary classification)
  • Features: Season, team1, team2, venue, toss winner, toss decision
  • Models compared: Logistic Regression and Random Forest Classifier
  • Encoding: Label Encoding for categorical features
  • Split: 80/20 train-test split

Results

Model Performance

Model Accuracy
Logistic Regression 54.6%
Random Forest 48.6%

Cricket match outcomes are inherently unpredictable (weather, form, toss luck), so accuracy in the 50-55% range is realistic and consistent with published cricket prediction research.

Key Insights

  • Toss impact is minimal: Winning the toss barely correlates with winning the match — nearly a 50/50 split in the data.
  • High-scoring matches are rising sharply: 200+ run totals were rare before 2022 but have surged in recent seasons, reflecting rule changes (Impact Player) and flatter pitches.
  • Top run-scorer (all-time): V Kohli, ~8,000 runs
  • Top wicket-taker (all-time): YS Chahal
  • Most experienced umpires: S Ravi and AK Chaudhary, both officiating 100+ matches

Project Structure

IPL-Cricket-Analysis/ ├── data/ # Kaggle CSVs (not included, see Dataset section) ├── outputs/ # Generated plots ├── preprocessing.py # Data loading and cleaning ├── eda.py # Exploratory data analysis and visualizations ├── modeling.py # Feature engineering and prediction models ├── tests.py # Automated sanity checks ├── main.py # Pipeline orchestrator └── README.md

How to Run

  1. Clone this repository
  2. Download the dataset from Kaggle and place matches.csv and deliveries.csv in a data/ folder
  3. Install dependencies: pip install pandas numpy matplotlib seaborn scikit-learn
  4. Run the full pipeline: python main.py

This will clean the data, generate all EDA plots into outputs/, and train/evaluate both prediction models.

Author

Laksha Ram

About

End-to-end IPL cricket analysis and match outcome prediction system using Python, Pandas, and scikit-learn. Covers EDA, player/team stats, and ML-based winner prediction on 17 years of IPL data (2008-2024).

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages