CoolFace
Datasetpublic

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.

sourceHugging Faceupdated 10mo agoView on Hugging Face
0likes95downloads
Dataset Card

🎾 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:

FeatureDescription
Rank_DiffRank_1 βˆ’ Rank_2 (competitive gap)
Pts_DiffPts_1 βˆ’ Pts_2 (performance gap)
Favorite_Flag1 if Odd_1 < Odd_2
Cluster_LabelK-Means cluster based on ranks and points

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)

[image]

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)

[image]

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

[image]

This scatter plot shows:

  • β€”A clear relationship between `Rank_Diff` and `Odd_1`.
  • β€”When Player 1 is much stronger (large negative Rank_Diff), Odd_1 tends to be lower.
  • β€”When Player 1 is weaker (positive Rank_Diff), Odd_1 increases.

This confirms that ranking gaps are a key driver of betting odds.


2.4 Odds by Surface

[image]

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:

  1. 1.Linear Regression
  2. 2.Random Forest Regressor
  3. 3.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)

[image]

We see that:

  • β€”Rank_Diff and Pts_Diff are 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:

  1. 1.Logistic Regression
  2. 2.Random Forest Classifier
  3. 3.Gradient Boosting Classifier

Main evaluation metric:

  • β€”Macro F1 β€” to balance performance across all three classes.

6.1 Confusion Matrix – Winning Classification Model (Random Forest)

[image]

The confusion matrix shows that:

  • β€”Random Forest handles all three classes reasonably well.
  • β€”It reduces false negatives in the High_Odds class, which is crucial for not missing risky underdog situations.

6.2 Feature Importance – Classification (Random Forest)

[image]

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.pkl
  • β€”winning_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

text
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