{"id":966,"date":"2021-03-22T22:33:02","date_gmt":"2021-03-22T22:33:02","guid":{"rendered":"https:\/\/miguelpdl.com\/weblog\/?p=966"},"modified":"2021-03-22T22:33:02","modified_gmt":"2021-03-22T22:33:02","slug":"advanced-football-visualisations-and-data-analysis-of-match-events","status":"publish","type":"post","link":"https:\/\/miguelpdl.com\/weblog\/advanced-football-visualisations-and-data-analysis-of-match-events\/","title":{"rendered":"Advanced football visualisations and data analysis of match events"},"content":{"rendered":"<p id=\"_purpose\"><span style=\"font-size: inherit; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;\">Luca Pappalardo an author of the paper <\/span><a style=\"font-size: inherit; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;\" href=\"https:\/\/doi.org\/10.1038\/s41597-019-0247-7\">(PCR2019) Pappalardo, L., Cintia, P., Rossi, A. et al. <strong>A public data set of spatio-temporal match events in soccer competitions<\/strong>. Nature Scientific Data 6, 236 (2019)<\/a><span style=\"font-size: inherit; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;\"> prepared a video, for the Friends of Tracking channel in 2020, to talk about some elements of this paper and the related Wyscout data set, which was used for the paper.<\/span><\/p>\n<div class=\"sectionbody\">\n<div class=\"paragraph\">\n<p>In this video Luca covers:<\/p>\n<\/div>\n<div class=\"ulist\">\n<ul>\n<li>The <a href=\"https:\/\/wyscout.com\/\">Wyscout data set<\/a>, how it is collected, from players to events.<\/li>\n<li>Basic statistics on events and distributions.<\/li>\n<li>Plotting events on the field, match evolution and spatial stats.<\/li>\n<li>Advanced statistics: passing networks, flow centrality and playerRank<\/li>\n<\/ul>\n<\/div>\n<div class=\"paragraph\">\n<p>For this blog post I&#8217;m going to cover my take on the player events in the Wyscout data set and the display of some basic statistics on events and distributions.<\/p>\n<p>The origin of the code is available on <a href=\"https:\/\/github.com\/Friends-of-Tracking-Data-FoTD\/mapping-match-events-in-Python\">Github under the project &#8220;mapping-match-events-in-Python&#8221;<\/a> and worked through in this video.<\/p>\n<\/div>\n<div class=\"videoblock\">\n<div class=\"content\"><iframe src=\"https:\/\/www.youtube.com\/embed\/ZXEHPKmx410?rel=0\" frameborder=\"0\" allowfullscreen=\"allowfullscreen\"><\/iframe><\/div>\n<\/div>\n<\/div>\n<div class=\"sect1\">\n<h2 id=\"_set_up\">Set up<\/h2>\n<div class=\"sectionbody\">\n<div class=\"paragraph\">\n<p>Under the organisation on <a href=\"https:\/\/github.com\/mmoffoot\">Github called mmoffoot<\/a> I forked the <a href=\"https:\/\/github.com\/mmoffoot\/mapping-match-events-in-Python\">&#8220;mapping-match-events-in-Python&#8221; repo into my mmoffoot<\/a> area.<\/p>\n<\/div>\n<div class=\"paragraph\">\n<p>Then I created a new branch called <a href=\"https:\/\/github.com\/mmoffoot\/mapping-match-events-in-Python\/tree\/englanddata\">&#8216;englanddata&#8217;<\/a> in this area to cover the changes I made.<\/p>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"sect1\">\n<div class=\"sectionbody\">\n<div class=\"paragraph\">\n<p>The example code base uses the Italian league data, but the branch name might be a give away, seeing as the data set has English Premier League information for the 2017-18 season I wanted to run the code base against that data set, and so I took a copy of the original Jupyter Notebook and ran it against the English data as <a href=\"https:\/\/github.com\/mmoffoot\/mapping-match-events-in-Python\/blob\/englanddata\/data_england_exploration.ipynb\">data_england_exploration.ipynb<\/a>.<\/p>\n<\/div>\n<div class=\"paragraph\">\n<p>The full list of data available includes:<\/p>\n<\/div>\n<div class=\"ulist\">\n<ul>\n<li>Italian first division 2017-18<\/li>\n<li>English first division 2017-18<\/li>\n<li>Spanish first division 2017-18<\/li>\n<li>French first division 2017-18<\/li>\n<li>German first division 2017-18<\/li>\n<li>European Championship 2017-18<\/li>\n<li>World Cup 2018<\/li>\n<\/ul>\n<\/div>\n<div class=\"paragraph\">\n<p>All the matches, events, players, and competition data sets are hosted in a <a href=\"https:\/\/doi.org\/10.6084\/m9.figshare.c.4415000.v5\">figshare repository<\/a> with all the data stored in a JSON format.<\/p>\n<\/div>\n<div class=\"paragraph\">\n<p>The way the data is collected is explained in the paper, with a nice visual representation in the Notebook so I won\u2019t ruin that insight and will let you read it in there.<\/p>\n<\/div>\n<div class=\"paragraph\">\n<p>I should say a quick word on <a href=\"https:\/\/jupyterlab.readthedocs.io\/en\/stable\/getting_started\/installation.html\">Jupyter Notebooks<\/a>, its an interactive way of developing and presenting data science projects, and I can really see that it\u2019s an easy way to follow the code base for this project. It\u2019s easy enough <a href=\"https:\/\/jupyter.org\/install\">to install Jupyter Notebook on a machine too<\/a> and well worth the install.<\/p>\n<\/div>\n<div class=\"sect2\">\n<h3 id=\"_plotting_events_on_the_field\">Plotting events on the field<\/h3>\n<div class=\"paragraph\">\n<p>There are a number of nice overviews of the structure of data given in the early part of the Notebook, but it\u2019s more interesting when it comes to the static plots.<\/p>\n<\/div>\n<div id=\"img-all-events\" class=\"imageblock\">\n<div class=\"content\"><a href=\"https:\/\/i0.wp.com\/miguelpdl.com\/weblog\/wp-content\/uploads\/2021\/03\/tot-lec-2018-events.png\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"985\" data-permalink=\"https:\/\/miguelpdl.com\/weblog\/advanced-football-visualisations-and-data-analysis-of-match-events\/tot-lec-2018-events\/\" data-orig-file=\"https:\/\/i0.wp.com\/miguelpdl.com\/weblog\/wp-content\/uploads\/2021\/03\/tot-lec-2018-events.png?fit=1000%2C405&amp;ssl=1\" data-orig-size=\"1000,405\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"tot-lec-2018-events\" data-image-description=\"\" data-image-caption=\"\" data-medium-file=\"https:\/\/i0.wp.com\/miguelpdl.com\/weblog\/wp-content\/uploads\/2021\/03\/tot-lec-2018-events.png?fit=300%2C122&amp;ssl=1\" data-large-file=\"https:\/\/i0.wp.com\/miguelpdl.com\/weblog\/wp-content\/uploads\/2021\/03\/tot-lec-2018-events.png?fit=1000%2C405&amp;ssl=1\" class=\"aligncenter size-full wp-image-985\" src=\"https:\/\/i0.wp.com\/miguelpdl.com\/weblog\/wp-content\/uploads\/2021\/03\/tot-lec-2018-events.png?resize=1000%2C405\" alt=\"\" width=\"1000\" height=\"405\" srcset=\"https:\/\/i0.wp.com\/miguelpdl.com\/weblog\/wp-content\/uploads\/2021\/03\/tot-lec-2018-events.png?w=1000&amp;ssl=1 1000w, https:\/\/i0.wp.com\/miguelpdl.com\/weblog\/wp-content\/uploads\/2021\/03\/tot-lec-2018-events.png?resize=300%2C122&amp;ssl=1 300w, https:\/\/i0.wp.com\/miguelpdl.com\/weblog\/wp-content\/uploads\/2021\/03\/tot-lec-2018-events.png?resize=768%2C311&amp;ssl=1 768w\" sizes=\"auto, (max-width: 1000px) 100vw, 1000px\" \/><\/a><\/div>\n<div class=\"title\">Figure 1: All Events Tottenham Hotspur 5 &#8211; 4 Leicester City, May 13, 2018.<\/div>\n<\/div>\n<div class=\"paragraph\">\n<p>Although of course too much detail can overwhelm and so the interactive plots in this Notebook are much better mechanism to share this information, as in you just have to hover the mouse over the event and its details come to the fore.<\/p>\n<\/div>\n<div id=\"img-passevents\" class=\"imageblock\">\n<div class=\"content\"><a href=\"https:\/\/i0.wp.com\/miguelpdl.com\/weblog\/wp-content\/uploads\/2021\/03\/tot-lec-2018-events-all-passes.png\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"984\" data-permalink=\"https:\/\/miguelpdl.com\/weblog\/advanced-football-visualisations-and-data-analysis-of-match-events\/tot-lec-2018-events-all-passes\/\" data-orig-file=\"https:\/\/i0.wp.com\/miguelpdl.com\/weblog\/wp-content\/uploads\/2021\/03\/tot-lec-2018-events-all-passes.png?fit=828%2C446&amp;ssl=1\" data-orig-size=\"828,446\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"tot-lec-2018-events-all-passes\" data-image-description=\"\" data-image-caption=\"\" data-medium-file=\"https:\/\/i0.wp.com\/miguelpdl.com\/weblog\/wp-content\/uploads\/2021\/03\/tot-lec-2018-events-all-passes.png?fit=300%2C162&amp;ssl=1\" data-large-file=\"https:\/\/i0.wp.com\/miguelpdl.com\/weblog\/wp-content\/uploads\/2021\/03\/tot-lec-2018-events-all-passes.png?fit=828%2C446&amp;ssl=1\" class=\"aligncenter size-full wp-image-984\" src=\"https:\/\/i0.wp.com\/miguelpdl.com\/weblog\/wp-content\/uploads\/2021\/03\/tot-lec-2018-events-all-passes.png?resize=828%2C446\" alt=\"\" width=\"828\" height=\"446\" srcset=\"https:\/\/i0.wp.com\/miguelpdl.com\/weblog\/wp-content\/uploads\/2021\/03\/tot-lec-2018-events-all-passes.png?w=828&amp;ssl=1 828w, https:\/\/i0.wp.com\/miguelpdl.com\/weblog\/wp-content\/uploads\/2021\/03\/tot-lec-2018-events-all-passes.png?resize=300%2C162&amp;ssl=1 300w, https:\/\/i0.wp.com\/miguelpdl.com\/weblog\/wp-content\/uploads\/2021\/03\/tot-lec-2018-events-all-passes.png?resize=768%2C414&amp;ssl=1 768w\" sizes=\"auto, (max-width: 828px) 100vw, 828px\" \/><\/a><\/div>\n<div class=\"title\">Figure 2: Pass Events Tottenham Hotspur &#8211; Leicester City, May 13, 2018.<\/div>\n<\/div>\n<div>&nbsp;<\/div>\n<\/div>\n<\/div>\n<div class=\"content\"><a href=\"https:\/\/i0.wp.com\/miguelpdl.com\/weblog\/wp-content\/uploads\/2021\/03\/tot-lec-2018-events-all-fouls.png\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"983\" data-permalink=\"https:\/\/miguelpdl.com\/weblog\/advanced-football-visualisations-and-data-analysis-of-match-events\/tot-lec-2018-events-all-fouls\/\" data-orig-file=\"https:\/\/i0.wp.com\/miguelpdl.com\/weblog\/wp-content\/uploads\/2021\/03\/tot-lec-2018-events-all-fouls.png?fit=742%2C453&amp;ssl=1\" data-orig-size=\"742,453\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"tot-lec-2018-events-all-fouls\" data-image-description=\"\" data-image-caption=\"\" data-medium-file=\"https:\/\/i0.wp.com\/miguelpdl.com\/weblog\/wp-content\/uploads\/2021\/03\/tot-lec-2018-events-all-fouls.png?fit=300%2C183&amp;ssl=1\" data-large-file=\"https:\/\/i0.wp.com\/miguelpdl.com\/weblog\/wp-content\/uploads\/2021\/03\/tot-lec-2018-events-all-fouls.png?fit=742%2C453&amp;ssl=1\" class=\"aligncenter size-full wp-image-983\" src=\"https:\/\/i0.wp.com\/miguelpdl.com\/weblog\/wp-content\/uploads\/2021\/03\/tot-lec-2018-events-all-fouls.png?resize=742%2C453\" alt=\"\" width=\"742\" height=\"453\" srcset=\"https:\/\/i0.wp.com\/miguelpdl.com\/weblog\/wp-content\/uploads\/2021\/03\/tot-lec-2018-events-all-fouls.png?w=742&amp;ssl=1 742w, https:\/\/i0.wp.com\/miguelpdl.com\/weblog\/wp-content\/uploads\/2021\/03\/tot-lec-2018-events-all-fouls.png?resize=300%2C183&amp;ssl=1 300w\" sizes=\"auto, (max-width: 742px) 100vw, 742px\" \/><\/a><\/div>\n<div class=\"sectionbody\">\n<div class=\"sect2\">\n<div id=\"img-foulevents\" class=\"imageblock\">\n<div class=\"title\">Figure 3: Foul Events Tottenham Hotspur &#8211; Leicester City, May 13, 2018.<\/div>\n<div>&nbsp;<\/div>\n<\/div>\n<div id=\"img-fouleventsplyr\" class=\"imageblock\">\n<div class=\"content\"><a href=\"https:\/\/i0.wp.com\/miguelpdl.com\/weblog\/wp-content\/uploads\/2021\/03\/tot-lec-2018-events-all-foul-player.png\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"982\" data-permalink=\"https:\/\/miguelpdl.com\/weblog\/advanced-football-visualisations-and-data-analysis-of-match-events\/tot-lec-2018-events-all-foul-player\/\" data-orig-file=\"https:\/\/i0.wp.com\/miguelpdl.com\/weblog\/wp-content\/uploads\/2021\/03\/tot-lec-2018-events-all-foul-player.png?fit=712%2C441&amp;ssl=1\" data-orig-size=\"712,441\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"tot-lec-2018-events-all-foul-player\" data-image-description=\"\" data-image-caption=\"\" data-medium-file=\"https:\/\/i0.wp.com\/miguelpdl.com\/weblog\/wp-content\/uploads\/2021\/03\/tot-lec-2018-events-all-foul-player.png?fit=300%2C186&amp;ssl=1\" data-large-file=\"https:\/\/i0.wp.com\/miguelpdl.com\/weblog\/wp-content\/uploads\/2021\/03\/tot-lec-2018-events-all-foul-player.png?fit=712%2C441&amp;ssl=1\" class=\"aligncenter size-full wp-image-982\" src=\"https:\/\/i0.wp.com\/miguelpdl.com\/weblog\/wp-content\/uploads\/2021\/03\/tot-lec-2018-events-all-foul-player.png?resize=712%2C441\" alt=\"\" width=\"712\" height=\"441\" srcset=\"https:\/\/i0.wp.com\/miguelpdl.com\/weblog\/wp-content\/uploads\/2021\/03\/tot-lec-2018-events-all-foul-player.png?w=712&amp;ssl=1 712w, https:\/\/i0.wp.com\/miguelpdl.com\/weblog\/wp-content\/uploads\/2021\/03\/tot-lec-2018-events-all-foul-player.png?resize=300%2C186&amp;ssl=1 300w\" sizes=\"auto, (max-width: 712px) 100vw, 712px\" \/><\/a><\/div>\n<div class=\"title\">Figure 4: Fouls by a specific player Tottenham Hotspur &#8211; Leicester City, May 13, 2018.<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n\n\n<p>This is a great Jupyter Notebook, firstly to really learn about Jupyter Notebooks, and then of course 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.<\/p>\n\n\n\n<p>There&#8217;s more to come, as I plan to complete the match evolution, spatial stats in part II of this blog post and finally cover the advanced statistics: passing networks, flow centrality and playerRank in a part III of this blog post.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Luca Pappalardo an author of the paper (PCR2019) Pappalardo, L., Cintia, P., Rossi, A. et al. A public data set of spatio-temporal match events in soccer competitions. Nature Scientific Data 6, 236 (2019) prepared a video, for the Friends of Tracking channel in 2020, to talk about some elements of this paper and the related [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"ngg_post_thumbnail":0,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[18,199],"tags":[185,204,200,216,217],"class_list":["post-966","post","type-post","status-publish","format-standard","hentry","category-football","category-mathematical-modelling-of-football","tag-football","tag-friends-of-tracking","tag-mathematical-modelling-of-football","tag-visualisations","tag-wyscout"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p7O9Cj-fA","jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/miguelpdl.com\/weblog\/wp-json\/wp\/v2\/posts\/966","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/miguelpdl.com\/weblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/miguelpdl.com\/weblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/miguelpdl.com\/weblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/miguelpdl.com\/weblog\/wp-json\/wp\/v2\/comments?post=966"}],"version-history":[{"count":1,"href":"https:\/\/miguelpdl.com\/weblog\/wp-json\/wp\/v2\/posts\/966\/revisions"}],"predecessor-version":[{"id":986,"href":"https:\/\/miguelpdl.com\/weblog\/wp-json\/wp\/v2\/posts\/966\/revisions\/986"}],"wp:attachment":[{"href":"https:\/\/miguelpdl.com\/weblog\/wp-json\/wp\/v2\/media?parent=966"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/miguelpdl.com\/weblog\/wp-json\/wp\/v2\/categories?post=966"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/miguelpdl.com\/weblog\/wp-json\/wp\/v2\/tags?post=966"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}