victor-iyi / epl-prediction

A Machine Learning solution to predicting the outcome of an English Premier League match
MIT License
9 stars 5 forks source link
adaboost artificial-intelligence epl flask flask-application machine-learning predictive-modeling

English Premier Leauge Prediction

The scope of this project is to predict the outcome of an English Premier Leauge match, based on historic data.

For more information about the data used, check notes.txt.

Installation

Requirements:

Create a virutal environment:

virtualenv .venv

Activate the environment:

source .venv/bin/activate

Install dependencies:

poetry install

Setup

Setup involves a 2 stage process.

Note: These steps are independent of each other as there is already a pre-trained model saved in AdaBoostClassifier.pkl

Run the Flask app

To run the application simply run the following command:

python __init__.py

The server should hopefully start running in http://127.0.0.1:5000

Home Page

Train the model

To train the model, simply run the following command:

python -m models.epl_engine

Change the default model

The default model used is AdaBoostClassifier, however you can change this to which ever sklearn model you desire by updating the main function in epl_engine.py

def main() -> None:
    # Change to the sklearn model you wish to use.
    from sklearn.ensemble import AdaBoostClassifier

    # ...code snippet

    # Update the following line accordingly to the imported model.
    clf = AdaBoostClassifier(n_estimators=500, learning_rate=1e-2)

Note: If you decide to change the model, be also sure to update the loaded classifier in the controller.py

# Change "AdaBoostClassifier.pkl" to whichever model you which to used
# saved in "models/trained/" folder.
CLF_PATH: str = os.path.join('models/trained/', 'AdaBoostClassifier.pkl')

Credits

Contribution

You are very welcome to modify and use them in your own projects.

Please keep a link to the original repository. If you have made a fork with substantial modifications that you feel may be useful, then please open a new issue on GitHub with a link and short description.

License (MIT)

This project is opened under the MIT which allows very broad use for both private and commercial purposes.

A few of the images used for demonstration purposes may be under copyright. These images are included under the "fair usage" laws.