nba-stats-predictor

NBA Stats Predictor

A deep learning tool that predicts NBA player statistics using historical data. The model analyzes player career trajectories to forecast future performance on a season-by-season basis.

🏀 Features

Project Structure

nba-stats-predictor/
├── data/                           # Generated data files
│   ├── nba_player_stats_*.csv     # Historical player statistics
│   ├── predicted_*_season.csv     # Model predictions
│   └── ...                        
├── scraper.ipynb                  # Web scraping notebook
├── trainer.ipynb                  # Model training notebook
├── guesser.ipynb                  # Prediction interface
├── nba_stats_predictor_model.keras # Saved model (generated)
└── normalization_params.json      # Model parameters (generated)

How It Works

  1. Data Collection (scraper.ipynb):
    • Scrapes historical NBA player statistics
    • Processes and cleans the raw data
    • Saves data to CSV format
  2. Model Training (trainer.ipynb):
    • Preprocesses data for deep learning
    • Saves preprocessed data to CSV format
    • Implements and trains LSTM model
    • Saves trained model and normalization parameters
  3. Predictions (guesser.ipynb):
    • Loads trained model and parameters
    • Makes predictions for future seasons
    • Exports predictions to CSV files

Getting Started

  1. Clone the repository:
    git clone https://github.com/srhn45/nba-stats-predictor.git
    cd nba-stats-predictor
    
  2. Install required packages:
    pip install tensorflow pandas numpy sklearn
    
  3. Run notebooks in order:
    • First run scraper.ipynb to collect data
    • Then trainer.ipynb to train the model
    • Finally guesser.ipynb to make predictions

    • Can run guesser.ipynb directly with the provided data if not looking to make changes

Generated Files

The following files are generated through the notebooks:

Note: All generated files can be recreated by running the notebooks in sequence.

Future Improvements and Additions

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the MIT License - see the LICENSE file for details.