Downloads · 30 days
0
Venus3009/football-match-predictor
football-match-predictor is a machine learning model from Venus3009. Use it for the machine learning task on the model card, and read the license before you ship it in a product. The card lists the license as mit.
A PyTorch MLP classifier that predicts the outcome of international football matches: Away Win, Draw, or Home Win.
Downloads · 30 days
0
Access
Public
Updated Feb 28, 2026
Repo size
204 KB
Likes
2
Public
Click a slice to open those files.
.pth204 KB · 97%
From the Hugging Face model README
A PyTorch MLP classifier that predicts the outcome of international football matches: Away Win, Draw, or Home Win.
| Field | Value |
|---|---|
| Author | Venus3009 |
| Framework | PyTorch |
| Task | Multi-class classification (3 classes) |
| Test Accuracy | 55.77% |
| Majority-class baseline | 49.0% |
| Random baseline | 33.3% |
International football results 1872–2026
Input (11) → Linear(256) → BatchNorm → ReLU → Dropout(0.3)
→ Linear(128) → BatchNorm → ReLU → Dropout(0.2)
→ Linear(64) → ReLU
→ Linear(3) → Softmax
| Feature | Description |
|---|---|
home_enc | Label-encoded home team name |
away_enc | Label-encoded away team name |
tour_enc | Label-encoded tournament name |
neutral_n | 1 if played at a neutral venue, 0 otherwise |
year | Match year (captures long-term team evolution) |
home_winrate | Home team win rate over last 20 games |
home_gf | Home team avg goals scored over last 20 games |
home_ga | Home team avg goals conceded over last 20 games |
away_winrate | Away team win rate over last 20 games |
away_gf | Away team avg goals scored over last 20 games |
away_ga | Away team avg goals conceded over last 20 games |
All features are normalized with StandardScaler before training.
| Index | Label | Meaning |
|---|---|---|
| 0 | Away Win | Away team wins |
| 1 | Draw | Match ends in a draw |
| 2 | Home Win | Home team wins |
import torch
import torch.nn as nn
import numpy as np
from sklearn.preprocessing import StandardScaler
class FootballPredictor(nn.Module):
def __init__(self, n_features=11):
super().__init__()
self.net = nn.Sequential(
nn.Linear(n_features, 256), nn.BatchNorm1d(256), nn.ReLU(), nn.Dropout(0.3),
nn.Linear(256, 128), nn.BatchNorm1d(128), nn.ReLU(), nn.Dropout(0.2),
nn.Linear(128, 64), nn.ReLU(),
nn.Linear(64, 3)
)
def forward(self, x):
return self.net(x)
# Load model
model = FootballPredictor()
model.load_state_dict(torch.load('football_predictor.pth', map_location='cpu'))
model.eval()
def predict_match(features_scaled):
"""
features_scaled: numpy array of shape (1, 11), already StandardScaler-transformed.
Returns predicted class and probabilities.
"""
with torch.no_grad():
x = torch.tensor(features_scaled, dtype=torch.float32)
probs = torch.softmax(model(x), dim=1)[0].numpy()
labels = ['Away Win', 'Draw', 'Home Win']
for label, prob in zip(labels, probs):
print(f" {label:<12} {prob*100:.1f}%")
print(f" → Prediction: {labels[probs.argmax()]}")
Temporal splitting is critical here: a random split would leak future matches into training and inflate accuracy.