Skip to content

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Machine Learning Medal Prediction

Overview

This project aims to predict the number of medals a country will win at the Summer Olympics using historical data and machine learning techniques. The workflow includes data preparation, feature engineering, and building a regression model to forecast medal counts.

Datasets

  • athlete_events.csv: Raw dataset containing Olympic athlete event results, including athlete demographics, event details, and medals won.
  • teams.csv: Processed dataset aggregating country-level statistics per Olympic year, such as number of athletes, average age, previous medals, and more.

Data Preparation

The data preparation is performed in data_prep.ipynb:

  • Filters for Summer Olympics only.
  • Aggregates athlete-level data to country-year level.
  • Computes features: number of events, athletes, average age, height, weight, and medals.
  • Adds features for previous medals and rolling average of medals over the last 3 Olympics.
  • Outputs the processed data to teams.csv.

Machine Learning Approach

Implemented in machine_learning.ipynb:

  • Loads and cleans the processed data.
  • Explores correlations and visualizes relationships between features and medal counts.
  • Splits data into training (pre-2012) and test (2012 and later) sets.
  • Trains a linear regression model using features such as number of athletes and previous medals.
  • Evaluates model performance using mean absolute error.
  • Analyzes prediction errors by country.

Project Structure

├── athlete_events.csv   # Raw Olympic athlete data
├── teams.csv            # Aggregated country-year features
├── data_prep.ipynb      # Data preparation and feature engineering
├── machine_learning.ipynb # Model training, evaluation, and analysis

Requirements

  • Python 3.x
  • pandas
  • numpy
  • scikit-learn
  • seaborn

Install dependencies with:

pip install pandas numpy scikit-learn seaborn

Usage

  1. Prepare the data:
    • Run data_prep.ipynb to generate teams.csv from athlete_events.csv.
  2. Train and evaluate the model:
    • Run machine_learning.ipynb to train the regression model and view results/analysis.

Example

  • Predicts medal counts for each country in recent Olympics (e.g., 2012, 2016).
  • Example features: number of athletes, average age, previous medals.
  • Example output: predicted vs. actual medals for countries like USA, IND, etc.

Contact

For questions or contributions, please open an issue or contact Mike Ayoti

About

This project predicts the number of medals countries will win at the Summer Olympics using historical athlete data and machine learning. It preprocesses Olympic data, engineers features, and applies regression models to forecast medal counts, enabling data-driven sports analytics.

Topics

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages