Code Monkey home page Code Monkey logo

english-premier-league-prediction's Introduction

English-Premier-League-Prediction

Apply machine learning to predict English Premier League soccer match.

Demo App

   

To Run

python3 model.py

Warning: Few python packages required to run the script. Install them all, or use a 3rd party IDE (such as spyder) that pre-installs these packages by default. Few of the packages required are:

  • brew cask install chromedriver
  • brew install libomp
  • pip3 install xgboost
  • pip3 install selenium

   

Scripts

1. clean_data.py

  • Includes necessary helper functions to process raw data

2. current_status.py

  • Collects and adds more details to the processed raw data
  • current/past standings, goals for/against/differences, etc.

3. match_history.py

  • Collects the latest match results

4. rankings.py

  • Calculate league points and generate standings

5. sofifa_scraper.py

  • Scrape overall team stat from FIFA

6. predict.py

  • With using processed data, train a ML model to predict future results

7. model.py

  • I/O file where the functions from the above files are actually executed

   

Data

1. data/raw/OVAs (directory)

  • scraped overall team stat data

2. data/cleaned/standings (directory)

  • historical standing results calculated in rankings.py

3. data/raw/results (directory)

  • manually collected historical data of match outcomes
  • latest match outcomes of the current season

4. data/cleaned/results (directory)

  • data extracted from data/raw/results

5. data/train_data/results (directory)

  • data processed from data/cleaned/results

6. data/statistics (directory)

  1. data/statistics/round_rankings (directory)
    • standings calculated based on the predicted match outcomes
    • each file in the directory has a date included in its name. It provides predicted standing outcomes at the denoted date
  2. data/statistics/prediction_ranking.csv
    • predicted standing at the end of the season
  3. data/statistics/prediction_result.csv
    • individual predicted match outcomes
  4. data/statistics/round_rankings_summary.csv
    • predicted standing summary over the course of the season

7. data/statistics/best_clf.joblib

  • disk cache of classifier that gives the best accuracy of prediction

8. data/database.db

  • sql database that stores previous match outcomes, predicted match results and predicted standings

9. data/train_data/final.csv

  • csv file used for training a model and making predictions

10. data/statistics/model_confidence.csv

  • list of grid searched classifiers and its confidence score

english-premier-league-prediction's People

Contributors

aznr avatar woongbinchoi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

english-premier-league-prediction's Issues

Proxy URL issue

Hi,
I try to run the 'sofifa_scarper.py' function. but I have an issue with URL from lines.

    # Start scraping.
    browser = webdriver.Chrome(ChromeDriverManager().install())
    browser.get("https://sofifa.com/teams?type=all&lg%5B%5D=13&lg%5B%5D=14")

Traceback (most recent call last):
File "c:\Users\hosseinv\PycharmProjects\English-Premier-League-Prediction-master\sofifa_scraper.py", line 134, in
scrape_team_ova_all("data/OVAs", 2006, 2019)
File "c:\Users\hosseinv\PycharmProjects\English-Premier-League-Prediction-master\sofifa_scraper.py", line 118, in scrape_team_ova_all
scrape_team_ova(from_year, to_year, path)
File "c:\Users\hosseinv\PycharmProjects\English-Premier-League-Prediction-master\sofifa_scraper.py", line 20, in scrape_team_ova
browser = webdriver.Chrome(ChromeDriverManager().install())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "c:\Users\hosseinv\PycharmProjects\English-Premier-League-Prediction-master\venv\Lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 80, in init
super().init(
File "c:\Users\hosseinv\PycharmProjects\English-Premier-League-Prediction-master\venv\Lib\site-packages\selenium\webdriver\chromium\webdriver.py", line 105, in init
command_executor=ChromiumRemoteConnection(
^^^^^^^^^^^^^^^^^^^^^^^^^
File "c:\Users\hosseinv\PycharmProjects\English-Premier-League-Prediction-master\venv\Lib\site-packages\selenium\webdriver\chromium\remote_connection.py", line 31, in init
super().init(remote_server_addr, keep_alive, ignore_proxy=ignore_proxy)
File "c:\Users\hosseinv\PycharmProjects\English-Premier-League-Prediction-master\venv\Lib\site-packages\selenium\webdriver\remote\remote_connection.py", line 180, in init
self._conn = self._get_connection_manager()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "c:\Users\hosseinv\PycharmProjects\English-Premier-League-Prediction-master\venv\Lib\site-packages\selenium\webdriver\remote\remote_connection.py", line 151, in _get_connection_manager
return urllib3.ProxyManager(self._proxy_url, **pool_manager_init_args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "c:\Users\hosseinv\PycharmProjects\English-Premier-League-Prediction-master\venv\Lib\site-packages\urllib3\poolmanager.py", line 481, in init
raise ProxySchemeUnknown(proxy.scheme)
urllib3.exceptions.ProxySchemeUnknown: Proxy URL had no scheme, should start with http:// or https://

and also, I can not install these packages by pycharm with python version 3.11.
how should install those, if this issue is related to this part?!

  • brew cask install chromedriver
  • brew install libomp

No connection could be made because the target machine actively refused it

Hey, I am working on a similar task and wanted to test your code to see if I could obtain any insights that might help me with the task.

I get a "No connection could be made because the target machine actively refused it" error. This is accompanied by a 404 in the browser. Do you have any idea why this is the case?

Regards, Ingo

image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.