A full stack application based on python and mongodb to scrape game data from https://stats.nba.com/ and build a continuous predictor.
First, clone repo if you haven't already and navigate into project directory e.g. Documents/nba_score_analyzer:
$ cd Documents/nba_score_analyzer
Initialize and activate a virtualenv:
$ virtualenv --no-site-packages env
$ source env/bin/activate
Install requirements:
pip install -r requirements.txt
Either run script with one argument to scrape a specific date:
python3 nba_scraper.py 02/27/2020
Or run script with two arguments to scrape games that fall in a specific interval:
python3 nba_scraper.py 02/12/2020 02/27/2020
The scraper will then access the endpoint and scrape the response with the formatting pictured below and store the json in as a document in the MongoDB database.
Response Header | Response Body |
---|---|
As of now everything concerning the prediction is located in the notebook called predictor.ipynb. The goal is to predict the winner of a future game given the features derived from past games. Therefore, I have fitted the following classifier:
- XGBClassifier
- SVC
- Logistic Regression