Skip to content

neenza/tnnp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tennis Match Predictor

A machine learning project that uses historical tennis match data to build ELO rating systems and predict match outcomes.

Overview

This project analyzes professional tennis matches to:

  1. Calculate standard and weighted ELO ratings for players
  2. Visualize player performance over time
  3. Predict match outcomes using neural networks
  4. Compare different rating systems and their predictive power

Data Source

The tennis match data used in this project is sourced from Tennis-Data.co.uk, which provides detailed historical match statistics for ATP and WTA tournaments. The dataset includes match results, player rankings, and score information dating back multiple years.

Features

ELO Rating Systems

  • Standard ELO: Traditional implementation of the ELO rating system
  • Weighted ELO: Advanced system that factors in match dominance based on set scores

Data Analysis

  • Historical player performance tracking
  • Interactive visualizations of rating changes over time
  • Comparative analysis between rating systems

Match Prediction

  • Neural network model for predicting match outcomes
  • Feature importance analysis
  • Interactive prediction interface for hypothetical matchups

Installation

  1. Clone the repository:
git clone https://github.com/neenza/tnnp.git
cd tnnp
  1. Install required packages:
pip install pandas numpy matplotlib seaborn scikit-learn tensorflow ipywidgets jupyterlab
  1. Download tennis match data files (Excel format) from Tennis-Data.co.uk and place them in the project directory.

Usage

Running the Jupyter Notebook

Launch Jupyter Lab or Notebook:

jupyter lab

Open the v2.ipynb notebook to run the full analysis pipeline.

Data Requirements

The system expects Excel files with tennis match data in the following format:

  • Match date in a 'Date' column
  • Winner and Loser in respective columns
  • Player rankings in 'WRank' and 'LRank' columns
  • Set scores in 'W1', 'L1', 'W2', 'L2', etc. columns

Key Components

Feature Engineering

The feature_engineering.py module processes raw match data into features suitable for machine learning:

  • ELO rating differences
  • Recent form indicators
  • Head-to-head statistics
  • Surface-specific performance metrics

Match Predictor

The match_predictor.py module implements:

  • Neural network architecture for binary classification
  • Model training and evaluation functions
  • Visualization tools for model performance
  • Feature importance analysis

Examples

Analyzing a player's ELO history

plot_player_elo_history('Roger Federer', rating_history)

Comparing ELO systems for a player

compare_elo_ratings('Rafael Nadal', rating_history, weighted_rating_history)

Predicting a match outcome

predict_match('Novak Djokovic', 'Andy Murray', fe, predictor, scaler)

Results

The model achieves approximately 65-70% accuracy in predicting match outcomes, with the weighted ELO system providing valuable additional predictive power compared to standard ELO ratings alone.

License

MIT License - see LICENSE file for details.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

About

A simple tennis prediction neural network model (68% accuracy)

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published