All Projects → ML-KULeuven → Soccer_xg

ML-KULeuven / Soccer_xg

Licence: apache-2.0
A Python package for training and analyzing expected goals (xG) models in soccer.

Projects that are alternatives of or similar to Soccer xg

Ia4business
Curso de Inteligencia Artificial aplicada a Negocios y Empresas
Stars: ✭ 59 (-1.67%)
Mutual labels:  jupyter-notebook
Rastermap
A multi-dimensional embedding algorithm
Stars: ✭ 58 (-3.33%)
Mutual labels:  jupyter-notebook
Learning Pandas Second Edition
Learning pandas, Second Edition, published by Packt
Stars: ✭ 59 (-1.67%)
Mutual labels:  jupyter-notebook
Pytorchdiscreteflows
Discrete Normalizing Flows implemented in PyTorch
Stars: ✭ 59 (-1.67%)
Mutual labels:  jupyter-notebook
Content based movie recommender
Stars: ✭ 59 (-1.67%)
Mutual labels:  jupyter-notebook
Applied Text Mining In Python
Repo for Applied Text Mining in Python (coursera) by University of Michigan
Stars: ✭ 59 (-1.67%)
Mutual labels:  jupyter-notebook
Gpclust
Collapsed Variational Bayes
Stars: ✭ 58 (-3.33%)
Mutual labels:  jupyter-notebook
Intro To Nltk
Code and Notebooks for the Natural Language Processing with Python course.
Stars: ✭ 59 (-1.67%)
Mutual labels:  jupyter-notebook
Gendis
Contains an implementation (sklearn API) of the algorithm proposed in "GENDIS: GEnetic DIscovery of Shapelets" and code to reproduce all experiments.
Stars: ✭ 59 (-1.67%)
Mutual labels:  jupyter-notebook
Deep Learning 101
The tools and syntax you need to code neural networks from day one.
Stars: ✭ 59 (-1.67%)
Mutual labels:  jupyter-notebook
Deej A.i.
Create automatic playlists by using Deep Learning to *listen* to the music
Stars: ✭ 57 (-5%)
Mutual labels:  jupyter-notebook
Road Lane Instance Segmentation Pytorch
tuSimple dataset road lane instance segmentation with PyTorch, ROS, ENet, SegNet and Discriminative Loss.
Stars: ✭ 59 (-1.67%)
Mutual labels:  jupyter-notebook
Home price estimator
Uses Zillow metadata, NLP on realtor description, and VGG16 on home images to predict home sale prices in Portland from 6/16 - 7/17.
Stars: ✭ 59 (-1.67%)
Mutual labels:  jupyter-notebook
College Majors Visualisation
Interactive Data Visualisation of U.S College Majors
Stars: ✭ 59 (-1.67%)
Mutual labels:  jupyter-notebook
Keras model compression
Model Compression Based on Geoffery Hinton's Logit Regression Method in Keras applied to MNIST 16x compression over 0.95 percent accuracy.An Implementation of "Distilling the Knowledge in a Neural Network - Geoffery Hinton et. al"
Stars: ✭ 59 (-1.67%)
Mutual labels:  jupyter-notebook
Mind
2020 MIND news recomendation first place solution
Stars: ✭ 59 (-1.67%)
Mutual labels:  jupyter-notebook
Pydata 2018
Stars: ✭ 59 (-1.67%)
Mutual labels:  jupyter-notebook
Feedinlib
This repository contains implementations of photovoltaic models to calculate electricity generation from a pv installation based on given solar radiation. Furthermore it contains all necessary pre-calculations.
Stars: ✭ 59 (-1.67%)
Mutual labels:  jupyter-notebook
Stylist
Fast artistic style transfer with convolutional neural networks.
Stars: ✭ 59 (-1.67%)
Mutual labels:  jupyter-notebook
Storytelling With Data
Course materials for Dartmouth Course: Storytelling with Data (PSYC 81.09).
Stars: ✭ 59 (-1.67%)
Mutual labels:  jupyter-notebook

Soccer xG

A Python package for training and analyzing expected goals (xG) models in soccer.




About

This repository contains the code and models for our series on the analysis of xG models:

In particular, it contains code for experimenting with an exhaustive set of features and machine learning pipelines for predicting xG values from soccer event stream data. Since we rely on the SPADL language as input format, soccer_xg currently supports event streams provided by Opta, Wyscout, and StatsBomb.

Getting started

The recommended way to install soccer_xg is to simply use pip:

$ pip install soccer-xg

Subsequently, a basic xG model can be trained and applied with the code below:

from itertools import product
from soccer_xg import XGModel, DataApi

# load the data
provider = 'wyscout_opensource'
leagues = ['ENG', 'ESP', 'ITA', 'GER', 'FRA']
seasons = ['1718']
api = DataApi([f"data/{provider}/spadl-{provider}-{l}-{s}.h5" 
        for (l,s) in product(leagues, seasons)])
# load the default pipeline
model = XGModel()
# train the model
model.train(api, training_seasons=[('ESP', '1718'), ('ITA', '1718'), ('GER', '1718')])
# validate the model
model.validate(api, validation_seasons=[('ENG', '1718')])
# predict xG values
model.estimate(api, game_ids=[2500098])

Although this default pipeline is suitable for computing xG, it is by no means the best possible model. The notebook 4-creating-custom-xg-pipelines illustrates how you can train your own xG models or you can use one of the four pipelines used in our blogpost series. These can be loaded with:

XGModel.load_model('openplay_logreg_basic')
XGModel.load_model('openplay_xgboost_basic')
XGModel.load_model('openplay_logreg_advanced')
XGModel.load_model('openplay_xgboost_advanced')

Note that these models are meant to predict shots from open play. To be able to compute xG values from all shot types, you will have to combine them with a pipeline for penalties and free kicks.

from soccer_xg import xg

openplay_model = xg.XGModel.load_model(f'openplay_xgboost_advanced') # custom pipeline for open play shots
penalty_model = xg.PenaltyXGModel() # default pipeline for penalties
freekick_model = xg.FreekickXGModel() # default pipeline for free kicks

model = xg.XGModel()
model.model = [openplay_model, penalty_model, freekick_model]
model.train(api, training_seasons=...)

For developers

Create venv and install deps

make init

Install git precommit hook

make precommit_install

Run linters, autoformat, tests etc.

make pretty lint test

Bump new version

make bump_major
make bump_minor
make bump_patch

License

Copyright (c) DTAI - KU Leuven – All rights reserved.
Licensed under the Apache License, Version 2.0
Written by Pieter Robberechts, 2020

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].