Giter Site home page Giter Site logo

crystalball's Introduction

Cover

Crystalball is a statistical method of predicting outcomes of NBA games. Accuracy has varied from 64% to 68% over the last couple of years that it has been operational. Feel free to predict NBA games using the simple script as outlined below.

Notes for the 2020-2021 Season:

No home or away dis/advantages due to no in-person attendance at games (COVID-19)

predict_game.py is the new and improved version of the game outcome predictor.

To run: python3 predict_game.py <home_year> <home_team_id> <away_year> <away_team_id>
For example: python3 predict_game.py 2021 MEM 2021 ATL
sim.py contains the primary methods for simulating games
utils.py contains methods for cleaning / parsing player data

Total Results

Total Games Games Predicted Correctly Accuracy
23 15 65.2%

Update: I stopped writing up the daily predictions in the readme, but let me know if that's something you want to see.

12.29.20 Forecast

"Home" "Away" Predicted Winner + % Prediction Timestamp Real Winner Notes
CLE NYK CLE 100.0% 12/29/2020 16:18 NYK xx
PHI TOR PHI 100.0% 12/29/2020 16:18 PHI xx
DET GSW DET 100.0% 12/29/2020 16:18 GSW xx
IND BOS IND 100.0% 12/29/2020 16:18 BOS xx
WAS CHI WAS 100.0% 12/29/2020 16:18 CHI xx
MIA MIL MIA 100.0% 12/29/2020 16:18 MIL xx
OKC ORL ORL 88.36% 12/29/2020 16:18 ORL xx
PHO NOP PHO 100.0% 12/29/2020 16:18 PHO xx
SAC DEN SAC 98.96% 12/29/2020 16:18 SAC xx
LAC MIN LAC 59.49% 12/29/2020 16:18 LAC xx

12.26.20 Forecast

"Home" "Away" Predicted Winner + % Prediction Timestamp Real Winner Notes
MEM ATL ATL 100.0% 12/26/2020 14:02 ATL xx
DET CLE CLE 100.0% 12/26/2020 14:02 CLE xx
WAS ORL ORL 100.0% 12/26/2020 14:02 ORL xx
CHO OKC xx xx xx No data on OKC yet
NYK PHI PHI 100.0% 12/26/2020 14:02 PHI xx
CHI IND IND 100.0% 12/26/2020 14:02 IND xx
SAS TOR SAS 100.0% 12/26/2020 14:02 SAS xx
UTA MIN UTA 100.0% 12/26/2020 14:02 MIN xx
SAC PHO SAC 98.945% 12/26/2020 14:02 SAC xx
POR HOU xx xx xx No data on HOU yet

12.25.20 Forecast

"Home" "Away" Predicted Winner + % Prediction Timestamp Real Winner Notes
MIA NOP NOP 100.0% 12/24/2020 18:43 MIA xx
MIL GSW MIL 100.0% 12/24/2020 18:43 MIL xx
BOS BRK BRK 100.0% 12/24/2020 18:43 BRK xx
LAL DAL DAL 53.397% 12/24/2020 19:04 LAL xx
DEN LAC LAC 78.898% 12/24/2020 18:43 LAC xx

crystalball's People

Contributors

sidharthrajaram avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

crystalball's Issues

How can i run script

Hi sidhart,
how are you?
i have a question
How can i run script?, but i dont know that script i should run.

trouble running

Hi, im not able to run this as i keep getting the error: Traceback (most recent call last):
File "C:/Users/risin/OneDrive/Documents/GitHub/CrystalBall/predict_game.py", line 6, in
simulate_game(sys.argv[1], sys.argv[3], sys.argv[2], sys.argv[4], display_info=True)
IndexError: list index out of range

Need somes info

Hey,

I'v fork the project and i'm looking for work on ;)
Actually i haven't my computer so i can't look python version needing.
Can you give me library and python version you use on master and lib infos ?
I'm looking for create docker adapatation (and i pull it on your project ;) )

Running Script

Hi,

I'm currently getting the following error, wondering if this is the correct format on running the script.
python3 predict_game.py 2020, DET, 2020, ATL

x@MacBook-Pro CrystalBall-master % python3 predict_game.py 2020, DET, 2020, ATL
Simulation Presets:
Epochs: 100000
Home Team Variation Range Max: 100
Away Team Variation Range Max: 100

Traceback (most recent call last):
File "predict_game.py", line 6, in
simulate_game(sys.argv[1], sys.argv[3], sys.argv[2], sys.argv[4], display_info=True)
File "/Users/zzz/Desktop/CrystalBall-master/sim.py", line 28, in simulate_game
t1_metric = team_score(t1_id, t1_year)
File "/Users/zzzDesktop/CrystalBall-master/sim.py", line 15, in team_score
df = getTeamDf(team_id, year)
File "/Users/zzz/Desktop/CrystalBall-master/sim.py", line 10, in getTeamDf
df_header = get_team_data(team_id, year, header=True)
File "/Users/zzz/Desktop/CrystalBall-master/utils.py", line 12, in get_team_data
team_stats_tuple = getTeamStats(team_id, year)
File "/Users/zzz/Desktop/CrystalBall-master/team_scraper.py", line 14, in getTeamStats
with urllib.request.urlopen(url) as response:
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/urllib/request.py", line 222, in urlopen
return opener.open(url, data, timeout)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/urllib/request.py", line 531, in open
response = meth(req, response)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/urllib/request.py", line 640, in http_response
response = self.parent.error(
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/urllib/request.py", line 569, in error
return self._call_chain(*args)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/urllib/request.py", line 502, in _call_chain
result = func(*args)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/urllib/request.py", line 649, in http_error_default
raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 404: Not Found

thanks,

Feature: Connect to Betfair

Hi,

Would you be interested in connecting to Betfair and automating the betting(paper)?

Would be an interesting exercise!

More date sources

Hi,

First, thank you for your work, is it a very good project !

I'd like to add more date sources i see it's in team_scraper.py

    team = team_id.upper()
url = "https://www.basketball-reference.com/teams/" + team + "/2019.html"```

I think it's more precise if you have more date, because in 2019 we have only 2 month past.
I want to scrap 2018 and 2019 years, it's possible to edit easily your code for it ?

Thank you !

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.