|
|
--- |
|
|
title: NBA Performance Predictor |
|
|
emoji: 🏀 |
|
|
colorFrom: orange |
|
|
colorTo: red |
|
|
sdk: gradio |
|
|
sdk_version: 3.40.0 |
|
|
app_file: app.py |
|
|
pinned: false |
|
|
license: mit |
|
|
--- |
|
|
|
|
|
|
|
|
# NBA Player Performance Predictor |
|
|
|
|
|
## Model Description |
|
|
|
|
|
This model predicts NBA player points per game (PPG) using XGBoost regression with time-series features. The model uses historical player statistics, lag features, and engineered metrics to make predictions. |
|
|
|
|
|
## Model Details |
|
|
|
|
|
- **Model Type**: XGBoost Regressor |
|
|
- **Task**: Regression (Predicting NBA player points per game) |
|
|
- **Framework**: scikit-learn, XGBoost |
|
|
- **Performance**: RMSE ~3-5 points per game, R² ~0.6-0.8 |
|
|
|
|
|
## Features |
|
|
|
|
|
The model uses various features including: |
|
|
- Basic stats: Age, Games, Minutes Played, Field Goals, etc. |
|
|
- Lag features: Previous season performance metrics |
|
|
- Rolling averages: 2-3 year performance averages |
|
|
- Efficiency metrics: Points per minute, overall efficiency |
|
|
- Categorical encodings: Position, Team, Age category |
|
|
|
|
|
## Usage |
|
|
|
|
|
```python |
|
|
from huggingface_model import NBAPerformancePredictorHF |
|
|
|
|
|
# Load the model |
|
|
model = NBAPerformancePredictorHF("path/to/model") |
|
|
|
|
|
# Example prediction |
|
|
player_stats = { |
|
|
'Age': 27, |
|
|
'G': 75, |
|
|
'GS': 70, |
|
|
'MP': 35.0, |
|
|
'FG': 8.5, |
|
|
'FGA': 18.0, |
|
|
'FG_1': 0.472, |
|
|
'Pos_encoded': 2, |
|
|
'Team_encoded': 15, |
|
|
'Age_category_encoded': 1, |
|
|
'PTS_lag_1': 22.5, |
|
|
'PTS_lag_2': 21.0, |
|
|
'TRB_lag_1': 7.2, |
|
|
'AST_lag_1': 4.8 |
|
|
} |
|
|
|
|
|
predicted_points = model.predict(player_stats) |
|
|
print(f"Predicted PPG: {predicted_points:.2f}") |
|
|
``` |
|
|
|
|
|
## Training Data |
|
|
|
|
|
The model was trained on NBA player statistics from multiple seasons, including: |
|
|
- Regular season statistics |
|
|
- Playoff performance data |
|
|
- Historical player performance trends |
|
|
|
|
|
## Limitations |
|
|
|
|
|
- Requires historical data (lag features) for accurate predictions |
|
|
- Performance may vary for rookie players or players with limited history |
|
|
- Model is trained on specific NBA eras and may need retraining for different time periods |
|
|
|
|
|
## Ethical Considerations |
|
|
|
|
|
This model is for educational and analytical purposes. It should not be used for: |
|
|
- Player salary negotiations |
|
|
- Draft decisions without additional context |
|
|
- Any form of discrimination or bias |
|
|
|
|
|
## Citation |
|
|
|
|
|
``` |
|
|
@misc{nba_performance_predictor, |
|
|
title={NBA Player Performance Predictor using XGBoost}, |
|
|
year={2024}, |
|
|
publisher={Hugging Face}, |
|
|
howpublished={\url{https://huggingface.co/your-username/nba-performance-predictor}} |
|
|
} |
|
|
``` |
|
|
|