From 9ee5ad75704e5edb54efc4e5878fc2c59974a106 Mon Sep 17 00:00:00 2001 From: ejmercier Date: Sun, 1 Oct 2023 22:52:52 -0400 Subject: [PATCH 1/2] Updated documentation --- README.md | 88 +++++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 66 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index cff3f2e5f..6a33e3f4e 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,53 @@ # NBA Sports Betting Using Machine Learning 🏀 -A machine learning AI used to predict the winners and under/overs of NBA games. Takes all team data from the 2007-08 season to current season, matched with odds of those games, using a neural network to predict winning bets for today's games. Achieves ~75% accuracy on money lines and ~58% on under/overs. Outputs expected value for teams money lines to provide better insight. The fraction of your bankroll to bet based on the Kelly Criterion is also outputted. Note that a popular, less risky approach is to bet 50% of the stake recommended by the Kelly Criterion. +A machine learning AI used to predict the winners and under/overs of NBA games. + +## About + +Takes all team data from the 2007-08 season to current season, matched with odds of those games, using a neural network to predict winning bets for today's games. + + Achieves ~75% accuracy on money lines and ~58% on under/overs. + +## Betting Strategy +Outputs expected value for teams money lines to provide better insight. The fraction of your bankroll to bet based on the Kelly Criterion is also outputted. + + Note that a popular, less risky approach is to bet 50% of the stake recommended by the Kelly Criterion. + +## Installation +*Side comment: +Make sure you use Python 3.8. If for some reason "python3" does not work, try using "python" instead.* +### Installing the source code +``` +git clone https://github.com/kyleskom/NBA-Machine-Learning-Sports-Betting.git +``` + +### Create environment + +Navigate into to project and create an environment +``` +cd NBA-Machine-Learning-Sports-Betting +``` +``` +python3 -m venv env +``` +### Activate environment +On Windows: +``` +source env\Scripts\activate.bat +``` +On Unix/MacOS: +``` +source env/bin/activate +``` + +### Install packages +``` +python3 -m pip install -r requirements.txt +``` ## Packages Used -Use Python 3.8. In particular the packages/libraries used are... +In particular the packages/libraries used are... * Tensorflow - Machine learning library * XGBoost - Gradient boosting framework @@ -21,42 +64,43 @@ Use Python 3.8. In particular the packages/libraries used are... Make sure all packages above are installed. -```bash -$ git clone https://github.com/kyleskom/NBA-Machine-Learning-Sports-Betting.git -$ cd NBA-Machine-Learning-Sports-Betting -$ pip3 install -r requirements.txt -$ python3 main.py -xgb -odds=fanduel ``` - -Odds data will be automatically fetched from sbrodds if the -odds option is provided with a sportsbook. Options include: fanduel, draftkings, betmgm, pointsbet, caesars, wynn, bet_rivers_ny +python3 main.py -xgb -odds=fanduel +``` +*Note: +Odds data will be automatically fetched from **sbrodds** if the -odds option is provided with a sportsbook. Options include: fanduel, draftkings, betmgm, pointsbet, caesars, wynn, bet_rivers_ny* If `-odds` is not given, enter the under/over and odds for today's games manually after starting the script. Optionally, you can add '-kc' as a command line argument to see the recommended fraction of your bankroll to wager based on the model's edge -## Flask Web App - - -This repo also includes a small Flask application to help view the data from this tool in the browser. To run it: -``` -cd Flask -flask --debug run -``` - -## Getting new data and training models +## How to get new Data and Train Models +### Create dataset with the latest data for 2022-23 season ``` -# Create dataset with the latest data for 2022-23 season cd src/Process-Data python -m Get_Data python -m Get_Odds_Data python -m Create_Games -# Train models +``` +### Train models +``` cd ../Train-Models python -m XGBoost_Model_ML python -m XGBoost_Model_UO ``` +## Flask Web App + + +This repo also includes a small Flask application to help view the data from this tool in the browser. To run it: +``` +cd Flask +flask --debug run +``` ## Contributing -All contributions welcomed and encouraged. +All contributions welcomed and encouraged. + +Please abide by the Open Source Contributing Guidelines: +https://opensource.guide/how-to-contribute/ From 9620e0a5fce1f4bb656a8b586774f26ba8cbc8b3 Mon Sep 17 00:00:00 2001 From: Eric Mercier <73543301+ejmercier@users.noreply.github.com> Date: Mon, 27 Nov 2023 15:48:42 -0500 Subject: [PATCH 2/2] Update README.md Co-authored-by: Kai Forsyth --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 6a33e3f4e..98ff13d04 100644 --- a/README.md +++ b/README.md @@ -72,7 +72,7 @@ Odds data will be automatically fetched from **sbrodds** if the -odds option is If `-odds` is not given, enter the under/over and odds for today's games manually after starting the script. -Optionally, you can add '-kc' as a command line argument to see the recommended fraction of your bankroll to wager based on the model's edge +Optionally, you can add `-kc` as a command line argument to see the recommended fraction of your bankroll to wager based on the model's edge ## How to get new Data and Train Models ### Create dataset with the latest data for 2022-23 season