-
Notifications
You must be signed in to change notification settings - Fork 423
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Updated ReadMe for future Use and Contributions #284
Open
ejmercier
wants to merge
2
commits into
kyleskom:master
Choose a base branch
from
ejmercier:Update-Documentation
base: master
Could not load branches
Branch not found: {{ refName }}
Could not load tags
Nothing to show
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,53 @@ | ||
# NBA Sports Betting Using Machine Learning 🏀 | ||
<img src="https://github.com/kyleskom/NBA-Machine-Learning-Sports-Betting/blob/master/Screenshots/output.png" width="1010" height="292" /> | ||
|
||
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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why is xgb model exclusively used over the other ones? |
||
``` | ||
*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 | ||
<img src="https://github.com/kyleskom/NBA-Machine-Learning-Sports-Betting/blob/master/Screenshots/Flask-App.png" width="922" height="580" /> | ||
|
||
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 | ||
``` | ||
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 | ||
|
||
## 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 | ||
<img src="https://github.com/kyleskom/NBA-Machine-Learning-Sports-Betting/blob/master/Screenshots/Flask-App.png" width="922" height="580" /> | ||
|
||
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/ |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this correct? The current model in the repo is at 68.9% on ML and 54.8% on OU