This repo started off as a project for UBC DSCI 522-- a course focusing on collaborative data science workflows and best practices.
Also, the original analysis was completed while we were beginning to learn ML basics. Here's my latest take on this project where I use Random Forests, XGBoost, Logistic Regression and more.
- Create a decision tree model for Lebron James's shots. Use our model to find the three strongest predictors for determining whether Lebron makes or misses a shot.
- Using a decistion tree model our findings suggest (1) Shot Distance, (2) Shot Clock and (3) Touch Time were the strongest predictors in dictating whether Lebron James would make a shot or not.
-
R:
tidyverse v1.2.1
-
Python:
argparse v1.1
pandas v0.20.3
matplotlib v3.0.1
numpy v1.15.4
scikit-learn v0.20.1
Without Docker + Without Make
-
Clone this repo.
-
Run these commands:
Rscript src/01_loading_wrangling.R "lebron james" data/shot_logs_raw.csv data/tidy_data_lebron_james.csv
python src/02_EDA.py data/tidy_data_lebron_james.csv results/figs/EDA "lebron james"
python src/03_machine_learning.py data/tidy_data_lebron_james.csv data/accuracies_lebron_james.csv data/features_lebron_james.csv
python src/04_analysis_plots_script.py data/accuracies_lebron_james.csv data/features_lebron_james.csv results/figs/train-test-acc_lebron_james.png results/figs/best_features_lebron_james.png
Rscript -e "rmarkdown::render('docs/Report.Rmd')"
With Make
-
With Make installed (install guides can be found here), clone this repo.
-
Run:
make all
With Docker
-
Clone this repo and navigate to the repo's root.
-
Run the analysis within a docker container with the following code in command line:
docker run --rm -it -v PATH_ON_YOUR_COMPUTER:/home/swish jessimk/dsci-522-jes-alex bash -c 'cd /home/swish; make'
-
To clean the analysis, use the following code in command line:
docker run --rm -it -v PATH_ON_YOUR_COMPUTER:/home/swish jessimk/dsci-522-jes-alex bash -c 'cd /home/swish; make clean'
π π π
-
2014-2015 NBA Season Shot Log from Kaggle; NBA Shot Logs Dataset
-
Other CSV's created with our scripts
- Figures from our Analysis
-
01_loading_wrangling.R
, loads and wrangles data -
02_EDA.py
, creates exploratory data analysis plots -
03_machine_learning.py
, performs machine learning -
04_analysis_plots_script.py
, creates plots from machine learning findings
β¨Future Dev Note: We plan to update our scripts so that they are flexible and robust enough to be able to run our analysis for any player in the data set. Stay tuned.β¨
π