Skip to content

Repository files navigation

NBA Shot Analysis

A Systematic Review of Machine Learning Models for Shot Outcome Prediction

Author: Jonathan Shimshoni

Academic Context: Data Science Workshop Project (OPENU) – 2025

Notebook: NBA_Shot_Analysis.ipynb

Project Explanation Video (Hebrew): Watch Video on Google Drive

Dataset: NBA Shots (Kaggle)

If the ipynb file is not rendering properly, download the HTML rendered notebook instead.


Overview

This project presents a comprehensive review that combines executable Python code, visualizations, statistical analyses, and discussions to investigate the stochastic challenge of NBA shot outcome prediction, along with other related interesting topics along the way.

Analyzing over 4.2 million shot attempts across 21 NBA seasons (from 2004–05 to 2024–25), the notebook functions as a complete academic report evaluating how well do different machine learning models and unsupervised player profiling methods turn raw data into basketball insights.


Data Science Methodologies Used

  • Data Integrity & Preprocessing: Data auditing, outlier handling (value clipping), feature standardization (Z-score scaling), and dataset cleaning.

  • Exploratory Data Analysis (EDA): Descriptive statistics, 2D spatial density mapping, univariate/bivariate feature distribution analysis, and correlation analysis.

  • Unsupervised Learning & Dimensionality Reduction: K-Means Clustering, Principal Component Analysis (PCA) & Factor Loadings, t-SNE 2D projections, and Separability Proof Classification.

  • High-Cardinality Categorical Representation: High-cardinality categorical encoding, 32-D PyTorch Entity Embeddings, and 32-D Centroid Distance feature spaces.

  • Supervised Learning & Ensemble Modeling: Binary Classification, Logistic Regression, K-Nearest Neighbors (KNN), Bagging Ensembles, Random Forests, Gradient Boosted Decision Trees (LightGBM), Feed-Forward Artificial Neural Networks (ANNs), and Hybrid Meta-Models.

  • Model Performance Evaluation: Accuracy, Precision, Recall, F1 Score, ROC-AUC (Area Under Curve), and Log Loss metrics.

  • Model Interpretability: SHAP (SHapley Additive exPlanations) and Feature Importance Analysis.


Notebook Outline

1. Introduction

2. Dataset Overview and Cleaning

3. EDA & Descriptive Statistics

4. Feature Engineering

5. Unsupervised Learning

6. Shot Prediction - Supervised Learning

7. Model Comparison and Discussion

8. Summary & Conclusions

To read through the full code, visualizations, discussions, and evaluations, open NBA_Shot_Analysis.ipynb


Tech Stack & Dependencies

  • Language & Environment: Python 3 (Google Colab)
  • Libraries: pandas, numpy, scikit-learn, torch (PyTorch), lightgbm, shap, plotly, seaborn, matplotlib
pip install pandas numpy scikit-learn torch lightgbm shap plotly seaborn matplotlib

License

Distributed under the MIT License. See LICENSE for more information.

About

A comprehensive data science project covering data cleaning, feature engineering, supervised ML models, and unsupervised learning to predict NBA shot outcomes across 4.2M attempts (2004–2025), all in one ipynb notebook

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages