Get Inspire insights from former attendees in our AMA discussion thread on Inspire Buzz. ACEs and other community members are on call all week to answer!

Engine Works

Under the hood of Alteryx: tips, tricks and how-tos.
wdavis
Alteryx
Alteryx

The season is rapidly approaching Christmas and if you’re anything like me, the panic has set in that your gut instincts and world-class football knowledge isn’t all that you imagined, and you’re handsomely sat in mid table of your leagues.

Don’t worry though, help is at hand! Using Alteryx, we can utilize the Advanced Analytics capabilities to make the decisions for us. Anybody who came along to Big Data London last month will have seen the first workings of this, but and we’ve now rounded out the Fantasy Premier League Tool category.

We have created The Fantasy Premier League Toolkit, consisting of three workflows and three macros. If you already have Alteryx, then you will simply need to download the workflows, open them in Designer and run. The macros will need to be saved to your macro folder (check out this article if you want to know how to do that).

Before going any further I should point out that this is aimed at improving your football/soccer fantasy team and therefore there may be some references which are a bit different to anyone used to American football! However, the workflows and methodology can be translated across to other sports.

For those not familiar with Fantasy Football; you are given a £100m budget and required to select a squad of 15 players consisting of 2 goalkeepers, 5 defenders, 5 midfielders and 3 strikers. You then get points based on how they perform in their individual games (Gameweeks) throughout the season.


How well has the model performed?

The big question is ultimately going to be how well Alteryx has been able to successfully select the Fantasy Dream Team. Will Alteryx as a football manager be able to class itself as the new ‘Special One’ or will we be falling into Paul Jewell’s elite level group (0% win ratio in 24 Premier League games)?

One thing to take into consideration is that our team, Alter.Formation, was only entered in gameweek (GW) 12, so we may have to wait until 2020 in order to win the overall league. Below is how we have fared vs the global average in the last three gameweeks:

GW 12 – 64 Points vs 48 Points Overall Average
GW 13 – 61 Points vs 49 Points Overall Average
GW 14 – 44 Points vs 51 Points Overall Average

A relatively good performance then! Here is how the Alter.Formation teams line up for Gameweek 15:

 

image1.png

 



What has been created for the Fantasy Football Tool Category?

With the assistance of my colleagues @NickC and @meljaafari there are now three workflows available:

All of these workflows have been built as Analytic Apps; select the wand icon next to the run button, and that will bring up the app interface. It will ask you to fill in the questions before running your workflow. If you Run the workflow normally (with the run button or ctrl+R), it will keep the default values. Each of the workflows also contain a more detailed description.

 

    • A Fantasy Football Optimizer – Select your full 15-man squad, perfect for using your wildcard
    • Player Comparison – Decide which position you want to replace, and it will provide you 2 players, plus a Top-Trump-style comparison, where you can compare the players on a number of key metrics to assist your decision
    • Private League Analysis – Pull all information about your own private leagues and the players within it. Want to understand how to topple that friend/colleague who is top of your league? Of course you do.
      • A complete week-by-week dataset is created for all players in your league, so you’ll know every change they’ve made, money left in the bank, which wildcards they have available, etc.



How does it all work?

 

    • Find the data you want:
      • The Fantasy Premier League (FPL) website is excellent for this, containing a whole wealth of data and statistics on the players and teams.
    • Find out how to access the data:
      • The data taken from FPL is done via a combination of APIs which are included ready in the workflows.
      • There isn’t a lot of documentation on this, but the workflows provided should contain all you need!
    • Clean, Prep and Blend:
      • The datasets returned from the APIs come in a messy format, so in each workflow there are a number of steps to clean, prep and blend the data.
      • This is where Alteryx is perfect! You can use the format and processes already built out to adjust the data you want to use from the API.
    • Advanced Analytics:
      • We have used the Optimization tool from the Prescriptive Tool category.
      • Below is some information on how this is configured; the key field to consider during this is the Coefficient.
        • Input O – This is where you input the variables (Player Names) and coefficients. In this instance, the coefficient is a player’s total score.
        • Input A – Matrix Constraint Table, set up to have each of the constraints (Positions and Teams) as Headers and the Player Names as your rows
        • Input B – Used to provide the direct and Right Hand Side (RHS) for your constraints. This is where you define how many Midfielders you could have for instance
    • Reporting
      • Tables have been created using the Reporting Tool Categories in order to make the data more visual – in particular for the Player Comparison Workflow


Bonus Macros!

As well as the three workflows that have been created, there are also three custom macros that you can use. These are included within the main workflows, of course, but can be used and edited elsewhere!

 

 

    • FPL Macro
      • Pulls player information required for the Private League workflow (similar logic also used in the other workflows) with 3 outputs
        • S – Stats
        • T – Total Players
        • D – Player Data
    • Top Trumps Macro
      • Outputs report for the player comparison, used in the Player Comparison workflow
      • You will be required to update the input files in the macro from the Fantasy Football Optimizer workflow
    • FPL Fixtures
      • Pulls the latest fixture for each team and the information on opposition strength
      • Used in Top Trumps macro


If you want to know more about any of the workflows, or anything Alteryx related, then feel free to get in contact. Better yet, reply to this blog!

Please feel free to use these workflows to your own benefit and to go and adapt them and make them better! For instance, we have based our coefficient in the Optimization model solely on a players’ Total Score, you could start to incorporate the players’ fixtures, strength of team, etc., all within that coefficient.

Happy fantasy footballing!

Comments
mceleavey
17 - Castor
17 - Castor

I developed a similar tool using the predictive suite and the Optimizer tool. 

 

I smell a competition...

 

M.