Blog of Random Thoughts and Pictures

Expected Goals (xG)

May 9th, 2021

As part of my LOI weekly predictions (don’t ask about match day 10 it was a wipe out) I’ve also included an indication of the teams expected goals (xG). Now it might be worth articulating an introduction to expected goals and there are four videos worth a review.

  • One by David Sumpter (Friends of Tracking)
  • One by Duncan Alexander at Opta.
  • One by Tifo football.
  • One with example goals with the xG overlaid on the screen.

First up David Sumpter on How to explain expected goals to a football player.

In this video David takes us through the probability of scoring a goal in the penalty area, with an overview of Barcelona statistics of expected Goals, indicating how a penalty is a 75% chance of scoring, and in comparison to a 7% chance of scoring, and an explanation of what this means.

True to the point there can and should be a reasoned discussion around goal scoring (and goal prevention) instead of always the emotional one, and xG gives some insights on this.

Opta’s Duncan Alexander takes us through the expected goals metric in the video Opta Expected Goals.

Of note (agt the time of the video), 4 variables are considered with Opta, Assist Type, Header / Foot, Big Chance and Angle/Distance.

The video by Tifo Football is a nice By The Numbers presentation on What is xG ?

They describe in nicer detail how good a shooting chance was, how likely a similar chances was, to result in a goal. They also highlight that people like StrataBet considers defenders in the way while other models like Opta do not and that sets of 5~10 games get best value for xG.

Expected goals (xG)

So expected goals (xG) is a probability of scoring a goal, with a look at how good a shooting chance was, how likely a similar chances was, to result in a goal.

Finally here’s a video demonstration of expected goals (xG)

LOI Matchday 10 Predictions

May 6th, 2021

First up news of the week in LOI has to be the dismissal of Kevin Sheedy from Waterford FC. I think the writing was on the wall from early on, dare I say before the season even started. Back to the drawing board for Waterford. Before making a prediction on their game, and the four others for matchday 10, a review of match day 9 shows a 3 out of 5 result, with two draws called correctly.

The running total is 20 correct results out of 45.

Now to the predictions for matchday 10

Derry City (64%) vs Longford (14%)
The Probability of a Draw between Derry City and Longford is 20%

The number of sim home wins for Derry City is = 8
The number of sim away wins for Longford is = 1
The number of sim draw is = 1

Derry City (1.0xG) vs Longford (0.78xG)

I went for a Derry win last week and it didn’t work out, but the predictions are aiming towards a Derry win again here, and so we stay with the Derry win (predicted)

Dundalk (61%) vs Sligo Rovers (16%)
The Probability of a Draw between Dundalk and Sligo Rovers is 22%

The number of sim home wins for Dundalk is = 5
The number of sim away wins for Sligo Rovers is = 2
The number of sim draw is = 3

Dundalk (1.41xG) vs Sligo Rovers (1.42xG)

Sligo are scoring away from home (xG) and these two teams had a draw on the opening day of the season. Data says Dundalk win, the heart says draw, but will go for the Dundalk win.

Waterford (55%) vs Drogheda (21%)
The Probability of a Draw between Waterford and Drogheda is 23%

The number of sim home wins for Waterford is = 6
The number of sim away wins for Drogheda is = 2
The number of sim draw is = 2

Waterford (0.62xG) vs Drogheda (0.76xG)

This will be a tight game again, well mainly a 0-0 type match, but the data is pointing towards a Waterford FC win, and we all need some cheering up, so a Waterford win in this one.

Bohemians (58%) vs Finn Harps (16%)
The Probability of a Draw between Bohemians and Finn Harps is 26%

The number of sim home wins for Bohemians is = 3
The number of sim away wins for Finn Harps is = 3
The number of sim draw is = 4

Bohemians (1.38xG) vs Finn Harps (1.26xG)

I’m going to call a draw in this one, the simmed matches and xG are indicating a draw and Finn Harps are tipping along nicely and I cannot push for the Bohs win, so a draw it will be.

St. Patricks (33%) vs Shamrock Rovers (38%)
The Probability of a Draw between St. Patricks and Shamrock Rovers is 29%

The number of sim home wins for St. Patricks is = 2
The number of sim away wins for Shamrock Rovers is = 4
The number of sim draw is = 4

St. Patricks (1.59xG) vs Shamrock Rovers (1.23xG)

And finally to the top of the table clash and this has a draw written all over it, and so another draw.

LOI Matchday 9 Predictions

May 2nd, 2021

It’s getting harder to keep up with all the matches happening in the LOI, but at least match day 8 (in review) was a good one as another 4 predictions out of 5 were on the button. Although I was way off the the one that was incorrect with Bohs getting beaten by Derry City, could anyone have seen that coming ?

The running total is 17 out of 40.

Now in to match day 9 predictions.

Drogheda (32%) vs Bohemians (41%)
The Probability of a Draw between Drogheda and Bohemians is 27%

The number of sim home wins for Drogheda is = 2
The number of sim away wins for Bohemians is = 6
The number of sim draw is = 2

Drogheda (1.12xG) vs Bohemians (1.45xG)

This is too close to call and so going for a draw.

Shamrock Rovers (58%) vs Waterford (18%)
The Probability of a Draw between Shamrock Rovers and Waterford is 24%

The number of sim home wins for Shamrock Rovers is = 3
The number of sim away wins for Waterford is = 6
The number of sim draw is = 1

Shamrock Rovers (2.09xG) vs Waterford (0.62xG)

The sim matches are playing tricks with me, but the call here has to be a Shamrock Rovers win

Longford (11%) vs Dundalk (69%)
The Probability of a Draw between Longford and Dundalk is 17%

The number of sim home wins for Longford is = 2
The number of sim away wins for Dundalk is = 7
The number of sim draw is = 1

Longford (0.77xG) vs Dundalk (1.2xG)

Dundalk are on a roll now and I’ll take them for a win in this one.

Sligo Rovers (36%) vs St. Patricks (35%)
The Probability of a Draw between Sligo Rovers and St. Patricks is 29%

The number of sim home wins for Sligo Rovers is = 4
The number of sim away wins for St. Patricks is = 4
The number of sim draw is = 2

Sligo Rovers (0.89xG) vs St. Patricks (0.90xG)

This is looking like a draw and will call it for a draw.

Derry City (61%) vs Finn Harps (15%)
The Probability of a Draw between Derry City and Finn Harps is 23%

The number of sim home wins for Derry City is = 6
The number of sim away wins for Finn Harps is = 2
The number of sim draw is = 2

Derry City (0.83xG) vs Finn Harps (1.08xG)

I wonder is Finn Harps early season bubble about to burst with Derry catching them ? All the pointers are towards a Derry City win so will go for a Derry win.

LOI Matchday 8 Predictions

April 30th, 2021

Match day 7 review and a 4 predictions out of 5 is pretty decent this time around, the league must be settling down now.

The running total is 13 out of 35.

Now in to match day 8 predictions.

St. Patricks (68%) vs Longford (11%)
The Probability of a Draw between St. Patricks and Longford is 18%

The number of sim home wins for St. Patricks is = 9
The number of sim away wins for Longford is = 0
The number of sim draw is = 1

St. Patricks (1.72xG) vs Longford (0.81xG)

Going for a St. Pats win here

Drogheda (30%) vs Sligo Rovers (43%)
The Probability of a Draw between Drogheda and Sligo Rovers is 26%

The number of sim home wins for Drogheda is = 0
The number of sim away wins for Sligo Rovers is = 5
The number of sim draw is = 5

Drogheda (1.11xG) vs Sligo Rovers (1.24xG)

Taking it as a draw for this one

Bohemians (40%) vs Derry City (31%)
The Probability of a Draw between Bohemians and Derry City is 28%

The number of sim home wins for Bohemians is = 6
The number of sim away wins for Derry City is = 2
The number of sim draw is = 2

Bohemians (0.97xG) vs Derry City (0.40xG)

Going for a narrow win for Bohs on this one.

Waterford (24%) vs Dundalk (51%)
The Probability of a Draw between Waterford and Dundalk is 24%

The number of sim home wins for Waterford is = 1
The number of sim away wins for Dundalk is = 8
The number of sim draw is = 1

Waterford (0.58xG) vs Dundalk (1.11xG)

Ahh hate saying this but looking like a Dundalk win

Finn Harps (14%) vs Shamrock Rovers (61%)
The Probability of a Draw between Finn Harps and Shamrock Rovers is 24%

The number of sim home wins for Finn Harps is = 0
The number of sim away wins for Shamrock Rovers is = 8
The number of sim draw is = 2

Finn Harps (1.16xG) vs Shamrock Rovers (1.17xG)

The xG is pointing at a draw, and Finn Harps have started well, but will go for the Rovers win in this one.

Good Practice in Football Visualisation

April 25th, 2021

This is a review of a special guest lecture from Opta’s Peter McKeever were he gives some insights in to how to make better data visualisations.

In this video Peter covers:

  • Elements of Matplotlib
  • Under the Hood: rcParams
  • Layering objects with zorder in plots
  • Works through a real world example

The origin of the code is available on Github under the project “friends-of-tracking-viz-lecture” and worked through in this video.

Peter’s slides are available here in this PDF document. Peter also has an excellent blog with code and further examples.

Set up

Under the organisation on Github called mmoffoot I forked the “friends-of-tracking-viz-lecture” repo into the mmoffoot area.

Then I created a new branch called ‘tottenham’ in this area to cover the changes I made.

What was coded

This is another Jupyter Notebook, but this time I just could not get it to load up the highlight_text python library and so I had to create a bog standard Python programme to run through this code base.

Then I found that highlight_text has changed its interface slightly since Peter coded against it. For example in the Notebook there’s the line

htext.fig_htext(s.format(team,ssn_start,ssn_end),0.15,0.99,highlight_colors=[primary], highlight_weights=["bold"],string_weight="bold",fontsize=22, fontfamily=title_font,color=text_color)

I had to change it to

htext.fig_text(0.15,0.86,s.format(team,ssn_start,ssn_end),highlight_colors=[primary], highlight_weights=["bold"],fontweight="bold",fontsize=22, fontfamily=title_font,color=text_color)

Given that Peter McKeever has run through all the elements coded via the YouTube video and there’s an associated slide deck this is a really nice resource to get started on exact visual items and how to then code them up. Of course for devilment I’ve gone for a Tottenham theme for the final output.

Tottenham’s goal difference from 2010/2011 to 2019/2020

Peter also talks about the blog posts by Lisa Rost which are well worth a review on how to visualise data. He also gives a pointer towards Tim Bayer and his work doing some things for Fantasy premier league, all of which is excellent.

Finally there’s ThemePy which is being developed, it is a theme selector / creator and aesthetic manager for Matplotlib. This wrappers aim is to simplify the process of customising matplotlib plots and to enable users who are relatively new to python or matplotlib to move beyond the default plotting params we are given with matplotlib.

LOI Matchday 7 Predictions

April 22nd, 2021

Match day 6 review and got 3 predictions out of 5, and things are getting a bit better.

The running total is 9 out of 30.

Now in to match day 7 predictions

Finn Harps (20%) vs St. Patricks (54%)
The Probability of a Draw between Finn Harps and St. Patricks is 26%

The number of sim home wins for Finn Harps is = 1
The number of sim away wins for St. Patricks is = 8
The number of sim draw is = 1

Finn Harps (1.05xG) vs St. Patricks (0.72xG)

Predicting St. Pats win here

Shamrock Rovers (56%) vs Bohemians (18%)
The Probability of a Draw between Shamrock Rovers and Bohemians is 26%

The number of sim home wins for Shamrock Rovers is = 8
The number of sim away wins for Bohemians is = 0
The number of sim draw is = 2

Shamrock Rovers (1.78xG) vs Bohemians (1.32xG)

Everything pointing to a Rovers win, let’s see

Dundalk (73%) vs Drogheda (8%)
The Probability of a Draw between Dundalk and Drogheda is 14%

The number of sim home wins for Dundalk is = 6
The number of sim away wins for Drogheda is = 0
The number of sim draw is = 4

Dundalk (1.45xG) vs Drogheda (0.67xG)

A Dundalk win here.

Waterford (63%) vs Longford (15%)
The Probability of a Draw between Waterford and Longford is 20%

The number of sim home wins for Waterford is = 7
The number of sim away wins for Longford is = 1
The number of sim draw is = 2

Waterford (0.57xG) vs Longford (0.70xG)

This is looking like a Waterford win, they certainly need one.

Sligo Rovers (42%) vs Derry City (30%)
The Probability of a Draw between Sligo Rovers and Derry City is 28%

The number of sim home wins for Sligo Rovers is = 6
The number of sim away wins for Derry City is = 2
The number of sim draw is = 2

Sligo Rovers (0.94xG) vs Derry City (0.26xG)

Going to go for a draw here.

LOI Matchday 6 Predictions

April 19th, 2021

Match day 5 review and got 2 predictions out of 5, and going a bit mad that I didn’t stick with the system selection of Sligo Rovers over Finn Harps.

The running total is 6 out of 25.

Now in to match day 6 predictions

Drogheda (18%) vs Shamrock Rovers (58%)
The Probability of a Draw between Drogheda and Shamrock Rovers is 23%

The number of sim home wins for Drogheda is = 1
The number of sim away wins for Shamrock Rovers is = 5
The number of sim draw is = 4

Drogheda (1.24xG) vs Shamrock Rovers (0.72xG)

Going for a Shamrock Rovers win.

St. Patricks (49%) vs Waterford (25%)
The Probability of a Draw between St. Patricks and Waterford is 26%

The Probability of a Home win for St. Patricks is 49%
The Probability of an Away win for Waterford is 25%

St. Patricks (1.39xG) vs Waterford (0.6xG)

Going for St. Pats win

Longford (42%) vs Finn Harps (30%)
The Probability of a Draw between Longford and Finn Harps is 28%

The number of sim home wins for Longford is = 5
The number of sim away wins for Finn Harps is = 3
The number of sim draw is = 2

Longford (0.86xG) vs Finn Harps (1.06xG)

Going for a draw in this one

Derry City (25%) vs Dundalk (49%)
The Probability of a Draw between Derry City and Dundalk is 25%

The number of sim home wins for Derry City is = 1
The number of sim away wins for Dundalk is = 8
The number of sim draw is = 1

Derry City (0.86xG) vs Dundalk (0.84xG)

Dundalk win in this case.

Bohemians (39%) vs Sligo Rovers (31%)
The Probability of a Draw between Bohemians and Sligo Rovers is 29%

The number of sim home wins for Bohemians is = 3
The number of sim away wins for Sligo Rovers is = 4
The number of sim draw is = 3

Bohemians (0.35xG) vs Sligo Rovers (1.09xG)

Going for a draw here.

LOI Matchday 5 Predictions

April 15th, 2021

Match day 5, starts with a review of match day 4 results, and I got 2 out of 6 games right, St. Pats are on a roll and won their game, and I got luck for once and got to recall the Derry vs Shamrock Rovers  result in favour of Rovers. For the season so far I’m 4 for 20 at the moment.

I’m going to add a little to the match day 5 predictions and have a little look at xG for the teams too.

So first up here’s what the system software spat out for Waterford vs Bohemians

Waterford (43%) vs Bohemians (29%)
The Probability of a Draw between Waterford and Bohemians is 28%

So the system is going for a Waterford win, but in another part were I simulate the matches I get

The number of sim home wins for Waterford is = 3
The number of sim away wins for Bohemians is = 6
The number of sim draw is = 1

So a Bohemians win.

There are stats for LOI with SoccerStats, and SportsMole being two good examples but for now I’ll just look to expected goals (xG) and that’s best viewed via FootyStats and for this match we have Waterford (0.17 xG) vs Bohemians (0.68 xG) so lets go for a Bohemians win.

For the next match the system has

Derry City (57%) vs Drogheda (19%)
The Probability of a Draw between Derry City and Drogheda is 22%

And in the sim games

The number of sim home wins for Derry City is = 5
The number of sim away wins for Drogheda is = 2
The number of sim draw is = 3

And xG is Derry City (0.71 xG) vs Drogheda (0.56 xG).

Everything is pointing towards a Derry first win of the season …… but Drogheda have started so well. Will have to go with the system answer and call a Derry win on this one.

The next match

Dundalk (56%) vs St. Patricks (19%)
The Probability of a Draw between Dundalk and St. Patricks is 24%

The number of sim home wins for Dundalk is = 6
The number of sim away wins for St. Patricks is = 1
The number of sim draw is = 3

Dundalk (1.35 xG) vs St. Patricks (N/A)

So everything is pointing to a Dundalk win, a first for the season here too …. predicted anyway.

The next match is

Shamrock Rovers (73%) vs Longford (8%)
The Probability of a Draw between Shamrock Rovers and Longford is 16%

The number of sim home wins for Shamrock Rovers is = 8
The number of sim away wins for Longford is = 1
The number of sim draw is = 1

Shamrock Rovers (0.76 xG) vs Longford (0.45 xG)

Calling a Shamrock Rovers win here.

And finally for match day 5 we’ll take

Sligo Rovers (60%) vs Finn Harps (15%)
The Probability of a Draw between Sligo Rovers and Finn Harps is 24%

The number of sim home wins for Sligo Rovers is = 5
The number of sim away wins for Finn Harps is = 3
The number of sim draw is = 2

And the xG Sligo Rovers (0.52 xG) vs Finn Harps (1.2 xG)

Now in this case the xG is in favour of Finn Harps, they are flying I’m going to buck the trend and go for a Finn Harps win.

Player Ranking Framework

April 11th, 2021

As mentioned in Part I of this multipart post, Luca Pappalardo prepared a video, for the Friends of Tracking channel in 2020, to talk about some elements of a paper related to an open Wyscout data set, and advanced statistics related to passing networks, flow centrality and player ranking.

For this post (Part IV) I’m going to cover my take on the PlayeRank framework created by this team of researchers.

I’ve forked the “mapping-match-events-in-Python” repo into my mmoffoot area and created a new branch called ‘englanddata’ to cover the data set of English Premier League information for the 2017-18 season.

An exhaustive description of the PlayeRank framework is available in this paper Pappalardo, Luca, Cintia, Paolo, Ferragina, Paolo, Massucco, Emanuele, Pedreschi, Dino & Giannotti, Fosca (2019) PlayeRank: Data-driven Performance Evaluation and Player Ranking in Soccer via a Machine Learning Approach. ACM Transactions on Intelligent Systems and Technologies 10(5).

This Notebook builds player rankings from match events, the following steps are required:

  • compute feature weights (learning)
  • compute roles (learning)
  • compute performance scores (rating)
  • aggregate performance scores (ranking)

It doesn’t take long to run through the [In] steps of the Notebook and for the English data you end up with Figure 1 as seen below.

Figure 1: Player Ranking English Premier League 2017-2018

The visual output from the Notebook is interactive which is great as you can hover over the points to catch the name. For example in the striker role H. Kane is the outlier (at the top), S. Augero second. There’s even a drop down menu to do a comparison.

Figure 2: Player Ranking Comparison for H. Kane and S. Augero English Premier League 2017-2018

The positions are an interesting element to this ranking systems which is based on a role matrix.

Team Attacking left to right, position 0 is a Striker

And the top players from English Premier League 2017-2018 for each role position

  • Position 0. = H. Kane
  • Position 1. = L. Milivojevic
  • Position 2. = N. Monreal
  • Position 3. = D. Janmaat
  • Position 4. = S. Mane
  • Position 5. = M. Salah
  • Position 6. = N. Otamendi
  • Position 7. = J. Stephens

If I look at the PFA Premier League Team of the Year for 2017-18, Otamendi, Kane and Salah were named in it and also appear here in PlayeRank, but none of the rest. I wonder how D. Silva and K. De Bruyne both of whom are in the PFA team, missed out in this PlayeRank framework.

Overall over 4 posts I can say this is a great Jupyter Notebook, firstly to really learn about Jupyter Notebooks, and secondly to be able to see the structure and how to use WyScout data. It is so important given this data set is used by so many tops clubs for the scouting, analyses and recruitment of players.

I got caught a little on the passing networks, and the flow centrality but certainly a thread of more investigation on a measure of cohesiveness within the team, would be a nice continuation of this topic.

The player ranking and the full explanation of the PlayeRank Framework was fantastic and a joy to read and interact with.

LOI Matchday 4 Predictions

April 8th, 2021

As I go into match day 4, a review of match day 3 reveals that I got, or should I start to say the system got, 1 result correct that was the Sligo Rovers win. While I hedged against them at the weekend it was good to see Waterford FC pick up their first points of the season.

The running tally so far after 14 games is 2 correct predictions, a 14% hit rate so far ….. terrible. Top of a local prediction league is 8 out of 14 so a bit to go there to catch up.

For match day 4 here are the predictions

St. Patricks (47%) vs Derry City (26%)
The Probability of a Draw between St. Patricks and Derry City is 26%

So calling a St. Pats win

Dundalk (62%) vs Bohemians (15%)
The Probability of a Draw between Dundalk and Bohemians is 22%

Dundalk have had a shaky start to the season, but will go for the Dundalk win.

Finn Harps (24%) vs Waterford (49%)
The Probability of a Draw between Finn Harps and Waterford is 27%

Finn Harps are flying it but the system is saying a Waterford win, so will go for the Waterford to win scenario and make up for last week.

Longford (36%) vs Drogheda (38%)
The Probability of a Draw between Longford and Drogheda is 25%

This is very close looks like it could be a draw.

Sligo Rovers (28%) vs Shamrock Rovers (43%)
The Probability of a Draw between Sligo Rovers and Shamrock Rovers is 29%

Dare I say a clash at the top of the table, and will go for a Rovers win …… Shamrock Rovers.

There’s an extra game this week

Derry City (29%) vs Shamrock Rovers (43%)
The Probability of a Draw between Derry City and Shamrock Rovers is 28%

And looks to be another Shamrock Rovers win to really put them top of the table. Now in truth I called this already as a draw a week or so back, but I’m going for Rovers win now.