An NBA Over/Under prediction model built using machine learning techniques to predict a statistic of an NBA player based on past statistics and other game-related data. This project uses logistic regression to classify whether the player's target statistic in his next game will go over or under a given betting line. It is intended for sports analysts, bettors, and anyone interested in analyzing NBA games.
Prerequisites:
- Python 3.7+
- Java 21.x+ (if using the GUI)
Installation:
- Clone this repository:
git clone https://github.com/yourusername/projectname.git - Navigate to the project directory:
cd projectname - Create a virtual environment to isolate dependencies:
python3 -m venv venv - Activate the virtual environment:
- For Linux/macOS:
source venv/bin/activate - For Windows:
venv\Scripts\activate
- For Linux/macOS:
- Install the required dependencies:
pip install -r requirements.txt
- First Name: The first name of the player (as found at https://www.nba.com/players)
- Last Name: The last name of the player (as found at https://www.nba.com/players)
- Target Stat: The statistical category you want to predict for (MIN, FGM, FGA, FG3M, FG3A, FTM, FTA, OREB, DREB, REB, AST, TOV, STL, BLK, PTS, PLUS_MINUS).
- Money Line: The betting line (e.g., 25.5).
-
Start the server in the
backendfolder. From the root project directory, run:- For Linux/macOS/Windows:
fastapi dev backend/main.py
- For Windows:
fastapi dev backend\main.py
- For Linux/macOS/Windows:
-
Compile the Java file in the
GUI/MoneyLinePredictor/srcfolder. From the root project directory, run:- For Linux/macOS/Windows:
javac GUI/MoneyLinePredictor/src/PredictorApp.java
- For Windows:
javac GUI\MoneyLinePredictor\src\PredictorApp.java
- For Linux/macOS/Windows:
-
Run the Java GUI application by executing the following command from the root project directory:
- For Linux/macOS:
java -cp GUI/MoneyLinePredictor/src PredictorApp
- For Windows:
java -cp GUI\MoneyLinePredictor\src PredictorApp
- For Linux/macOS:
-
In the name box: enter the first name and last name of the player.
-
In the target stat box: enter the desired statistic.
-
In the money line box: enter the betting line.
-
Click the predict button to see the prediction.
If you encounter any issues, here are a few things to check:
- Ensure that you've activated the virtual environment and installed the dependencies using
pip install -r requirements.txt - Ensure you're using Python 3.x. Verify the version by running
python --version - Make sure you have Java 21.x+ installed for the GUI. If there are issues compiling and running the
.javafile, try reinstalling Java.
This project uses the following libraries and resources:
- scikit-learn: A machine learning library for Python. (https://scikit-learn.org/)
- pandas: A data manipulation and analysis library. (https://pandas.pydata.org/)
- nba_api: Python API client for accessing NBA.com data. (https://github.com/swar/nba_api/)