Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bomada/tennis-blog
Data extraction and modelling for the tennis blog
https://github.com/bomada/tennis-blog
atp fantasy ml portfolio python tennis
Last synced: about 1 month ago
JSON representation
Data extraction and modelling for the tennis blog
- Host: GitHub
- URL: https://github.com/bomada/tennis-blog
- Owner: Bomada
- Created: 2019-06-03T06:23:53.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2024-01-18T11:29:40.000Z (11 months ago)
- Last Synced: 2024-11-16T22:56:24.140Z (about 1 month ago)
- Topics: atp, fantasy, ml, portfolio, python, tennis
- Language: Jupyter Notebook
- Size: 7.82 MB
- Stars: 6
- Watchers: 2
- Forks: 1
- Open Issues: 18
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Table of Contents
1. [Installation](#installation)
2. [Project Motivation](#motivation)
3. [File Descriptions](#files)
4. [Project Process](#process)
5. [Licensing, Authors, Acknowledgements](#licensing)# Installation
The xgboost library is needed to run the code here beyond the Anaconda distribution of Python. The code should run with no issues using Python versions 3. See the requirements.txt file for details about library versions.# Project Motivation
Since I'm both a big tennis fan and data nerd, I've long wanted to know how a machine learning algorithm would cope against the best fantasy tennis players in the world.# File Descriptions
Input data used:
- **data/tdc/tdc_2018.csv**: Data about the best fantasy tennis player's predictions for 2018. Manually collected data from www.tennisdrawchallenge.com
- **data/atp** (directory): ATP data provided by Jeff Sackmann on https://github.com/JeffSackmann/tennis_atp
- **tennis-blog.ipynb**: Exploratory notebook with all steps necessary to answer the question if a machine could beat the best fantasy tennis player.# Project Process
When working with this project I followed the CRISP-DM process. The details are found in the notebook but here is a quick summary:## Business Understanding
To find out if a machine learning model could beat a fantasy tennis player I created a challenge where the goal was to predict the correct winners of tennis matches. I then tried to answer three questions:
1. How good would the strategy of always picking the best ranked player be? (Benchmark Prediction)
2. How good is the best fantasy tennis player at predicting tennis matches? (Best Fantasy Tennis Player Prediction)
3. How good is a machine learning model at predicting tennis matches? (Machine Learning Prediction)## Data Understanding
To be able to answer the question I manually collected data on the best fantasy tennis player from www.tennisdrawchallenge.com. In addition I got ATP tennis data from Jeff Sackmann's Github repository.## Prepare Data
Before I could build a model many things were done to the data. Columns were modified, new features created, missing values imputed and much more. Before training the model data was split into a training and a test set.## Data Modeling
First I choose to use accuracy as the metric to evaluate model performance. Next I trained and tested four supervised learning models:
- Logistic Regression
- Gaussian Naive Bayes
- Random Forest
- XGBoost## Results
Using a XGBoost model I managed to beat the best fantasy tennis player in the world. More details are found in this blog post:
https://medium.com/@marcusnilsson78/can-a-machine-beat-the-best-fantasy-tennis-player-in-the-world-130538bd3e11## Deploy
Output of this project was a notebook and a blog post so nothing were deployed into production.# Licensing, Authors, Acknowledgements
## Code
Copyright 2019 Marcus NilssonPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
## Data
Give credit to www.tennisdrawchallenge.com for the fantasy tennis data and letting me use screenshots of their site for the blog post.For the ATP data I must give a huge thank you to Jeff Sackmann. He has provided free high quality tennis data for years. The ATP data from Jeff comes with the following license:
Tennis databases, files, and algorithms by Jeff Sackmann / Tennis Abstract is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
Based on a work at https://github.com/JeffSackmann.In other words: Attribution is required. Non-commercial use only.