https://github.com/theoddysey/epl-predictor
EPL โฝ Prediction App using Streamlit ๐ซ
https://github.com/theoddysey/epl-predictor
epl python random-forest-classifier streamlit
Last synced: 11 days ago
JSON representation
EPL โฝ Prediction App using Streamlit ๐ซ
- Host: GitHub
- URL: https://github.com/theoddysey/epl-predictor
- Owner: TheODDYSEY
- License: mit
- Created: 2024-11-11T08:52:18.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2024-11-11T09:02:48.000Z (over 1 year ago)
- Last Synced: 2025-01-10T20:43:03.761Z (over 1 year ago)
- Topics: epl, python, random-forest-classifier, streamlit
- Language: Python
- Homepage: https://theoddysey-epl-predictor-app-mabpex.streamlit.app/
- Size: 1.87 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
- License: LICENSE
Awesome Lists containing this project
README
# โฝ EPL Expected Goals Projector
### Predict Premier League match scores using Machine Learning & Poisson Statistics








**[๐ Live Demo โ](https://theoddysey-epl-predictor-app-mabpex.streamlit.app/)**
---
## ๐ธ Preview

---
## ๐ About
**EPL Expected Goals Projector** is a Streamlit web app that predicts English Premier League match outcomes using historical match data and four machine learning approaches. Select a season, pick two teams, and get projected scorelines, win probabilities, and RMSE metrics โ all in real time.
---
## โจ Features
- โฝ **Score projection** โ predicted home and away goals for any EPL fixture
- ๐ **Win probability** โ home win / draw / away win percentages (Poisson model)
- ๐ค **4 prediction models** โ Poisson, Random Forest, XGBoost, and Ensemble
- ๐
**Multi-season support** โ select and compare across different EPL seasons
- ๐ **RMSE display** โ model accuracy metric shown per prediction
- โ
**Actual score comparison** โ shows real result if the match has already happened
- ๐ง **Feature selection** โ automatically identifies most correlated stats per model
---
## ๐ค Models
| Model | Type | Description |
|---|---|---|
| **Poisson Distribution** | Statistical | Models goals as independent Poisson processes; outputs win probabilities |
| **Random Forest** | ML Regressor | Ensemble of decision trees trained on cumulative team stats |
| **XGBoost** | ML Regressor | Gradient-boosted trees; handles non-linear feature interactions |
| **Ensemble** | Combined | Averages RF and XGBoost predictions for reduced variance |
---
## โ๏ธ How It Works
### 1 โ Data Preparation
Historical EPL match CSV files are loaded from `engg_data/`. Each file is cleaned and transformed to produce per-team cumulative statistics: wins, draws, losses, points, goals scored, goals conceded, and league position up to each matchday.
### 2 โ Feature Selection
For each prediction target (home goals, away goals), the pipeline computes Pearson correlations against all available features and selects the most correlated subset to feed into the model.
### 3 โ Model Training
Separate regression models are trained for home goals and away goals. The Ensemble model averages the outputs of Random Forest and XGBoost. Poisson parameters (ฮป_home, ฮป_away) are derived from historical attack and defence strength ratios.
### 4 โ Prediction
When a fixture is selected, the system retrieves each team's latest cumulative stats up to that matchday, feeds them into the chosen model, and returns projected scorelines.
### 5 โ Visualization
The Streamlit UI displays the projected score, win probabilities (Poisson), RMSE, and โ if the match has occurred โ the actual result for comparison.
---
## ๐ Getting Started
### Prerequisites
- Python 3.x
- pip
### Installation
```bash
# 1. Clone the repository
git clone https://github.com/TheODDYSEY/EPL-Predictor.git
cd EPL-Predictor
# 2. Install dependencies
pip install -r requirements.txt
# 3. Run the app
streamlit run app.py
```
> Open your browser at `http://localhost:8501`
---
## ๐ฅ๏ธ Usage
1. Select an **EPL season** from the dropdown
2. Choose a **prediction model** โ Poisson, RandomForest, XGBoost, or Ensemble
3. Pick the **Home team** and **Away team**
4. Click **Run**
5. View projected score, win probabilities, actual result, and RMSE
---
## ๐ Project Structure
```
EPL-Predictor/
โโโ app.py # Streamlit application entry point
โโโ requirements.txt # Python dependencies
โโโ engg_data/ # Engineered CSV files per EPL season
โโโ data/ # Raw historical match data
โโโ img/
โโโ app.png # App preview screenshot
```
---
## ๐ ๏ธ Tech Stack
| Library | Purpose |
|---|---|
|  | Web UI framework |
|  | Data loading, cleaning, feature engineering |
|  | Random Forest Regressor, metrics |
|  | Gradient-boosted regression |
| `SciPy` | Poisson distribution and probability calculations |
---
## ๐ค Contributing
Pull requests and issues are welcome. Fork the repo, make your changes, and open a PR.
---
## ๐ License
Licensed under the [MIT License](LICENSE).
---
## ๐ Acknowledgments
- [Football-Data.org](https://www.football-data.org/) for historical EPL match data
- [Streamlit](https://streamlit.io/) for the web framework
- [Scikit-learn](https://scikit-learn.org/) and [XGBoost](https://xgboost.readthedocs.io/) for ML algorithms
---
## โญ Star History
[](https://star-history.com/#TheODDYSEY/EPL-Predictor&Date)
---
Made with โค๏ธ using Python & Streamlit ย ยทย โฝ Happy predicting!