Nevoreuven/tennis-betting-odds-model
πΎ Predicting Tennis Betting Dynamics Using Machine Learning Regression, Classification & Feature Engineering on WTA 2007β2023 Match Data This project explores whether machine learning models can predict betting odds and betting risk levels from historical WTA tennis statistics.Using a large-scale dataset (2007β2023), we built regression and classification models to understand how ranking, performance gaps, match context, and engineered features shape bettingβ¦ See the full description on the dataset page: https://huggingface.co/datasets/Nevoreuven/tennis-betting-odds-model.
πΎ Predicting Tennis Betting Dynamics Using Machine Learning
Regression, Classification & Feature Engineering on WTA 2007β2023 Match Data
This project explores whether machine learning models can predict betting odds and betting risk levels from historical WTA tennis statistics. Using a large-scale dataset (2007β2023), we built regression and classification models to understand how ranking, performance gaps, match context, and engineered features shape betting market behavior.
The final goal: Can historical match statistics help identify betting patterns and support decision-making in real time?
1. Dataset Overview
Dataset used: WTA Tennis 2007β2023 Daily Update Size: ~50,000 matches
Features extracted:
- Player rankings (
Rank_1,Rank_2) - Player points (
Pts_1,Pts_2) - Betting odds (
Odd_1,Odd_2) - Match attributes (
Surface,Round)
Engineered features:
These features proved essential for improving model performance.
2. Exploratory Data Analysis (EDA)
We started by exploring the distribution of betting odds and competitive gaps.
2.1 Distribution of Pre-Match Odds (Odd_1)
This plot shows that:
- Most matches have low odds for Player 1 (strong favorites).
- There is a long tail of higher odds representing clear underdogs.
2.2 Distribution of Ranking Difference (Rank_Diff)
Interpretation:
- Many matches are played between players with small rank differences.
- Large positive or negative gaps are less common but very influential in betting.
2.3 Relationship Between Ranking Gap and Odds
This scatter plot shows:
- A clear relationship between `Rank_Diff` and `Odd_1`.
- When Player 1 is much stronger (large negative
Rank_Diff),Odd_1tends to be lower. - When Player 1 is weaker (positive
Rank_Diff),Odd_1increases.
This confirms that ranking gaps are a key driver of betting odds.
2.4 Odds by Surface
We see that:
- Odds distributions differ slightly across Hard, Clay, and Grass.
- Some surfaces exhibit higher variance in odds, reflecting different levels of uncertainty.
3. Feature Engineering
We engineered several features to improve predictive power:
β RankDiff & PtsDiff
Capture performance gaps between players β strong predictors of market expectations.
β Favorite_Flag
Binary indicator:
1β Player 1 is the pre-match favorite (Odd_1 < Odd_2)0β Player 1 is the underdog
β Cluster_Label (K-Means)
K-Means clustering on:
Rank_1,Rank_2,Pts_1,Pts_2
This groups matches into tiers (balanced, uneven, elite matchups) and adds a latent βmatch typeβ signal to the model.
All engineered features were inspected visually and statistically before modeling.
4. Regression Modeling: Predicting Betting Odds (Odd_1)
We trained three regression models to predict Odd_1:
- Linear Regression
- Random Forest Regressor
- Gradient Boosting Regressor (π Winning regression model)
Evaluation metrics:
- MAE (Mean Absolute Error)
- RMSE (Root Mean Squared Error)
- RΒ² (Goodness of fit)
4.1 Feature Importance β Regression (Gradient Boosting)
We see that:
Rank_DiffandPts_Diffare among the most important predictors.- Cluster-based features (
Cluster_Label) and favorite information (Favorite_Flag) also contribute significantly.
Why Gradient Boosting Won:
- Best RΒ² score
- Lowest errors (MAE/RMSE)
- Handles nonlinear tennis behavior better than linear models
The final regression model is saved as: winning_regression_model.pkl
5. Converting Regression to Classification
To create a classification problem, we transformed Odd_1 into three balanced classes using quantiles:
- Low_Odds β strong favorites
- Medium_Odds β balanced matches
- High_Odds β clear underdogs
This created a well-balanced classification setup where each class has a similar number of samples.
We also discussed:
- Recall vs Precision: Recall is more important, because missing a high-value opportunity (false negative) is more costly than marking a match as risky when it is not.
6. Classification Modeling: Predicting Odd_Class (Risk Level)
We trained three classification models:
- Logistic Regression
- Random Forest Classifier
- Gradient Boosting Classifier
Main evaluation metric:
- Macro F1 β to balance performance across all three classes.
6.1 Confusion Matrix β Winning Classification Model (Random Forest)
The confusion matrix shows that:
- Random Forest handles all three classes reasonably well.
- It reduces false negatives in the
High_Oddsclass, which is crucial for not missing risky underdog situations.
6.2 Feature Importance β Classification (Random Forest)
Key insights:
- The same engineered features (
Rank_Diff,Pts_Diff,Favorite_Flag,Cluster_Label) are highly influential. - Match context (
Surface,Round) also plays a role in predicting risk levels.
Why Random Forest Won:
- Highest Macro F1 score
- Most stable performance across all odds classes
- Best trade-off between recall and precision in the risk classification task
The final classification model is saved as: winning_classification_model.pkl
7. Model Deployment
Both models were exported as .pkl pipelines:
winning_regression_model.pklwinning_classification_model.pkl
They can be:
- Loaded in external Python environments
- Used for batch or near real-time predictions on new matches
- Integrated into a future sports analytics & betting decision-support system
8. Final Insights & Conclusion
β Can historical statistics predict betting odds?
Yes. The regression model successfully learned the structure of betting markets using ranking, point differences, and match-level context.
β Can we classify matches into betting risk levels?
Yes. The Random Forest classifier reliably distinguishes between Low, Medium, and High odds categories.
β Can this support real-time betting decisions?
Partially.
- These models work with pre-match data only.
- For full real-time betting, additional information is needed (live score, momentum, injuries, etc.).
Still, the models provide a solid foundation for pre-match risk assessment.
β What this project demonstrates
- Machine learning can meaningfully model betting markets
- Tennis statistics provide strong predictive signals
- Feature engineering dramatically improves performance
- Combining regression + classification creates a foundation for an automated betting recommender system
9. Repository Structure
Copy_of_Assignment_2_Classification,_Regression,_Clustering,_Evaluation.ipynb
1_distribution_odd1.png
2_distribution_rank_diff.png
3_rank_diff_vs_odd1.png
4_odd1_by_surface.png
5_confusion_matrix_rf.png
6_feature_importance_regression_gb.png
7_feature_importance_classification_rf.png
winning_regression_model.pkl (optional alias: winning_model.pkl)
winning_classification_model.pkl
wta (1).csv
README.md
