A journey from zero to beating IBM's AI predictions at Wimbledon 2025
This project implements a complete neural network system from scratch (no TensorFlow, no PyTorch) to predict professional tennis match outcomes. The ultimate goal: outperform IBM's SlamTracker AI in predicting Wimbledon 2025 tournament results.
Build a neural network from the ground up and prove it can compete with commercial AI systems.
Starting with nothing but NumPy and raw ATP tennis data, this project:
- β Implements a 2-hidden-layer neural network from scratch
- β Engineers 37 advanced features from historical match data
- β Achieves 67.4% accuracy on 2024 test matches
- β Beats IBM's Slamtracker by 1.6% on Wimbledon 2025 predictions (66.1% vs 64.6%)
| Metric | Result |
|---|---|
| Test Accuracy (2024) | 67.4% |
| Wimbledon 2025 Accuracy | 66.1% (84/127 matches) |
| IBM's Slamtracker Accuracy | 64.6% (82/127 matches) |
| Improvement over IBM | +1.6% (+2 matches) |
| Training Data | 150,000+ ATP matches (1968-2024) |
| Features Engineered | 37 advanced features |
| Round | Our Model | IBM's Slamtracker | Difference |
|---|---|---|---|
| Round 1 | 59.4% (38/64) | 56.2% (36/64) | +3.1% β |
| Round 2 | 65.6% (21/32) | 68.8% (22/32) | -3.1% |
| Round 3 | 75.0% (12/16) | 56.2% (9/16) | +18.8% β |
| Round 4 | 100.0% (8/8) | 100.0% (8/8) | Tied |
| Quarter Finals | 50.0% (2/4) | 100.0% (4/4) | -50.0% |
| Semi Finals | 100.0% (2/2) | 100.0% (2/2) | Tied |
| Final | 100.0% (1/1) | 100.0% (1/1) | Tied |
Notable Achievement: Perfect prediction of the Wimbledon 2025 Final (Sinner vs Alcaraz) with 99% confidence!
Input Layer: 37 features
β
Hidden Layer 1: 128 neurons (Leaky ReLU, Ξ±=0.01)
β
Hidden Layer 2: 64 neurons (Leaky ReLU, Ξ±=0.01)
β
Output Layer: 1 neuron (Sigmoid)
- No Deep Learning Frameworks: Pure NumPy implementation
- Custom Backpropagation: Manually implemented gradient descent
- ADAM Optimizer: From-scratch implementation with momentum
- L2 Regularization: Prevents overfitting (Ξ»=0.3)
- He Initialization: Optimal weight initialization for ReLU variants
- Early Stopping: Validation-based training termination
- StandardScaler Normalization: Critical for L2 regularization
- 37 Engineered Features including:
- Historical win rates (career, surface-specific, recent form)
- Service statistics (ace rates, double fault rates, first serve %)
- Head-to-head records
- Tournament context (importance, surface type)
- Player attributes (age, height, experience, handedness)
- Temporal features (cyclical month encoding)
- Interaction features (rankΓsurface, form differences)
- β Chronological feature computation
- β No in-match statistics used
- β Historical averages from past matches only
- β Strict temporal train/validation/test split
ANN/
|
βββ requirements.txt # Python dependencies
β
βββ datas/ # Raw ATP match data
β βββ atp_matches_1968.csv # Historical matches by year
β βββ atp_matches_1969.csv
β βββ ...
β βββ atp_matches_2024.csv
β βββ README.md # Data source documentation
β
βββ notebooks/ # Main project notebooks
β βββ 2HLayer_ANN.ipynb # π― Main neural network implementation
β β
β βββ FeatureEngineering/ # Feature engineering pipeline
β β βββ 01_data_inspection.py # Exploratory data analysis
β β βββ 02_data_cleaning.py # Data cleaning & preprocessing
β β βββ 03_feature_engineering.py # Feature creation (37 features)
β β βββ 04_create_npz_dataset.py # Final dataset preparation
β β βββ 05_correlation_analysis.py # Feature correlation analysis
β β βββ run_all.py # Run entire pipeline
β β βββ atp_featured_dataset.npz # Final training dataset
β β
β βββ 2025Wimbledon/ # Wimbledon 2025 predictions
β βββ prepare_wimbledon_features.py
β βββ normalize_wimbledon.py
β βββ 2025_wimbledon_matches.csv
β βββ IBM's_predictions.csv # IBM SlamTacker predictions
β βββ rounds/ # Round-by-round results
β βββ Round1_FirstRound.csv
β βββ Round2_SecondRound.csv
β βββ ...
β
βββ README.md # This file
- Python 3.12+ (tested on 3.12.7)
- 8GB+ RAM recommended
- macOS, Linux, or Windows
- Clone the repository
cd ~/Desktop
git clone <your-repo-url> ANN
cd ANN- Create virtual environment
python3 -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate- Install dependencies
pip install -r requirements.txt# Open Jupyter notebook
jupyter notebook notebooks/2HLayer_ANN.ipynb
# In the notebook:
# 1. Run cells 1-3 to load the pre-trained dataset
# 2. Skip to cell 11 to load saved model parameters (if available)
# 3. Run evaluation cells to see results# Step 1: Prepare the dataset
cd notebooks/FeatureEngineering
python run_all.py # Runs entire feature engineering pipeline (~10-15 minutes)
# Step 2: Train the model
cd ..
jupyter notebook 2HLayer_ANN.ipynb
# In the notebook:
# 1. Run all cells in sequence
# 2. Choose Phase 1 (find best epoch with validation)
# 3. Choose Model 2 (Leaky ReLU + He initialization - recommended)
# 4. Wait for training (~5-10 minutes)
# 5. Note the best epoch number
# 6. Run Phase 2 with the best epoch for final trainingThe feature engineering process transforms raw ATP match data into ML-ready features:
cd notebooks/FeatureEngineering
# Option A: Run entire pipeline
python run_all.py
# Option B: Run step-by-step
python 01_data_inspection.py # Analyze raw data
python 02_data_cleaning.py # Clean and preprocess
python 03_feature_engineering.py # Create 37 features
python 04_create_npz_dataset.py # Prepare final datasetOutput: atp_featured_dataset.npz (37 features Γ 150,000+ matches)
Open notebooks/2HLayer_ANN.ipynb in Jupyter:
# Cell 1: Load data
# Cell 2: Configure hyperparameters
# Cell 3-4: Define model functions
# Cell 5: Training control
# When prompted:
# - Choose option 1 (Phase 1 - Find best epoch)
# - Choose option 2 (Leaky ReLU + He initialization)
# Training will run with early stopping
# Note the "best epoch" number (e.g., 1350)# Run the training cell again:
# - Choose option 2 (Phase 2 - Final training)
# - Enter the best epoch number from Phase 1
# - Model trains on full dataset (train + validation)# Run evaluation cells to see:
# - Test set accuracy (2024 matches)
# - Confidence distribution analysis
# - Detailed match predictionscd notebooks/2025Wimbledon
# Prepare Wimbledon data
python prepare_wimbledon_features.py
python normalize_wimbledon.py
# Run predictions (in Jupyter notebook)
# Execute the Wimbledon prediction cell in 2HLayer_ANN.ipynbThe notebook automatically compares predictions with IBM's:
- Round-by-round accuracy comparison
- Confidence level analysis
- Head-to-head performance metrics
Results are saved in notebooks/win.txt
N_X = 37 # Input features
N_H1 = 128 # First hidden layer
N_H2 = 64 # Second hidden layer
N_Y = 1 # Output (binary classification)LEARNING_RATE = 0.003 # ADAM learning rate
EPOCHS = 5000 # Maximum epochs
PATIENCE = 10 # Early stopping patience
LAMBDA = 0.3 # L2 regularization strength
BETA1 = 0.9 # ADAM momentum
BETA2 = 0.999 # ADAM RMSprop- Activation: Leaky ReLU (Ξ±=0.01) for hidden layers
- Initialization: He initialization
- Optimizer: ADAM (faster convergence than SGD)
- Normalization: StandardScaler (mean=0, std=1)
Overall Test Accuracy: 67.4% on 2024 matches
- Better than random (50%)
- Better than "always pick higher rank"
- Better than logistic regression
- Competitive with commercial systems
Top predictive features:
- Recent form (last 10 matches)
- Surface-specific win rate
- Head-to-head record
- Historical service statistics
- Ranking points differential
This project demonstrates:
- β Forward propagation implementation
- β Backpropagation and gradient computation
- β Activation functions (Sigmoid, Tanh, Leaky ReLU)
- β Weight initialization strategies (Xavier, He)
- β Optimization algorithms (ADAM)
- β Regularization techniques (L2, early stopping)
- β Data preprocessing and normalization
- β Feature engineering and selection
- β Train/validation/test splitting
- β Hyperparameter tuning
- β Model evaluation and validation
- β Data leakage prevention
- β Modular code architecture
- β Comprehensive documentation
- β Version control and reproducibility
- β Performance optimization
Issue: FileNotFoundError: atp_featured_dataset.npz
# Solution: Run feature engineering pipeline first
cd notebooks/FeatureEngineering
python run_all.pyIssue: Training accuracy stuck at 50%
# Solution: Check normalization
# Ensure StandardScaler is applied (not max normalization)
# Verify in 04_create_npz_dataset.pyIssue: Model overfitting (train acc >> test acc)
# Solution: Increase L2 regularization
LAMBDA = 0.5 # Try higher values (0.3 β 0.5 β 0.7)Issue: Training too slow
# Solution: Reduce dataset size or epochs
EPOCHS = 2000 # Reduce from 5000
# Or use smaller subset of data for testingIssue: Memory error during feature engineering
# Solution: Process data in chunks
# Modify 03_feature_engineering.py to process years separately- Use Leaky ReLU (faster than Tanh)
- Use ADAM optimizer (faster than SGD)
- Reduce PATIENCE for quicker early stopping
- Use smaller validation set
- Increase hidden layer sizes (128β256, 64β128)
- Add more features (player injury history, weather data)
- Tune learning rate (try 0.001, 0.003, 0.01)
- Experiment with L2 lambda (0.1, 0.3, 0.5)
- Use ensemble methods (train multiple models)
Add a third hidden layer:
N_H3 = 32 # Add between H2 and output
# Update forward/backward propagation accordinglyTry different activation functions:
# ReLU
A = np.maximum(0, Z)
# ELU (smoother than ReLU)
A = np.where(Z > 0, Z, alpha * (np.exp(Z) - 1))Implement dropout regularization:
# During training
keep_prob = 0.8
mask = np.random.rand(*A.shape) < keep_prob
A = A * mask / keep_probThis is an educational project, but improvements are welcome!
- Additional feature engineering ideas
- Alternative neural network architectures
- Performance optimizations
- Better visualization tools
- Extended documentation
- Jeff Sackmann: For maintaining the tennis_atp dataset
For questions, suggestions, or collaboration:
- Open an issue on GitHub
This project proves that understanding fundamentals beats using black-box libraries. By building a neural network from scratch, we:
- Gained deep understanding of how neural networks work
- Achieved competitive performance with commercial AI systems
- Demonstrated that careful feature engineering matters more than complex architectures
Key Takeaway: You don't need TensorFlow or PyTorch to build effective AI systems. Understanding the math and implementing it yourself leads to better insights and more robust solutions.
β If you found this project helpful, please star the repository!
πΎ Happy Predicting!