We're currently in the middle of the 22nd series of Taskmaster1 here in the UK which - for the uninitiated - involves a group of (pseudo-) celebrities competing to perform a variety of deeply silly tasks. The contestant lineups vary but are similar in spirit - usually a combination of comedians, TV presenters, and increasingly a token member from across the pond.
The contestant that I've been thinking about (and there's always one!) is the absolutely awful one - failing almost every task thrown at them through incompetence, indifference or outright malice. Miraculously though, they always seem to manage to win at least one episode, no matter how hard they try to avoid doing so.
The questions I need to answer, nay, the nation demands answers to, are the following:
Is this a miracle?
If so, is statistically surprising?
Can I jam some physics into the answer regardless? (I think we know this one. Is it foreshadowing given it's been fore-foreshadowed in the post description? Is this a post-foreshadowing?)
Let's start, as all good things do, with some data.
Fetching the data
Fortunately the UK is blessed with an abundance of nerds eccentrics, who have gathered every possible detail about the aired episodes of Taskmaster, no matter how small. In this case I used:
...with support from TaskMaster.Info5 for confirmation of the task ordering and formats.
The cleaned CSV file contains 182 episodes from series 1-20, including 940 tasks and 4,700 scores. (Special and tiebreak tasks are not included.) You can view and download the dataset here:
Loading cleaned taskmaster scores…
To compare contestants across different series, let's define a 'win credit':
If you win an episode, you get 1 credit
If you draw with, say, 2 other contestants, you get credits
Then, per series, we rank contestants from strongest to weakest using 'task credits' - a normalised score per-task, assuming tasks in the series:
Sorting contestants this way, then summing up all win credits from all series, we get the following:
Actual win credits across 20 series of UK Taskmaster.
So far, so unsurprising - the strongest contestant in each series wins the most episodes. No miracles just yet. The question we need to ask ourselves though, is whether this distribution is what we'd expect?
Taskmaster is filmed in a particular fashion - the contestants perform their tasks in quick succession, usually independently. Later on, all contestants are brought together to film in-studio segments where the task performances are reviewed and scored. This approach gives the nefarious task scheduler the chance to allocate tasks to episodes in any order they like - they might choose to pick all of the strong task performances for the weakest performer and place them in one episode, just to give them an (undeserved) chance to win an episode.
(Very much like gerrymandering6, though with more rubber ducks involved and - probably - a lower chance of triggering the inexorable descent into autocracy.)
We can perform a numerical experiment to investigate this possibility: shuffle the tasks amongst episodes while retaining the per-task scores. The per-series strong/weak classification of contestants isn't affected, but the win credits are. After performing many shufflings and averaging the results, here's what we see:
The weakest contestants tend to score more highly than random chance would suggest! Shuffling can also be thought of dealing 'hands' of tasks to each series at random.
Ah-hah! I don't need to be no stinkin' statistician to spot that those bars are different heights. As the foreshadowing above predicted, the weakest contestants are observed to perform more strongly than average, and everyone else more weakly.
This is certainly suggestive, but we'll need to be more confident than that to convince the nerds eccentrics of the distributed Taskmaster fandom - let's continue down the rabbit hole.
Choosing a model
Let's get clear with some definitions before continuing:
There are a huge number of valid Taskmaster schedules across 20 series - together they form a set
A particular valid schedule is .
The weakest contestant scores win credits under the schedule .
The observed weakest-contestant-win-credit is , and the shuffled average is .
Let's assume at zeroth order that the probability of seeing any given schedule amongst all possibilities is uniform, i.e.
This is the model that the 'Shuffled average' bars above represent - when shuffling, we just pick schedules uniformly at random.
Clearly though in reality this model is incorrect, otherwise the bars above would match. We need to deform in a sensible way, then measure how much deformation is required to match the observation (and whether this deformation is significant!)
To pick a 'good' deformation I'd usually reach for physical intuition, which is sadly not possible here. (Or is it? Post-post-foreshadowing count: 2.) Instead, we can peer across the fence to our friends in the information theory department, and borrow their concept of relative entropy: a metric to compare probability distributions. The deformed distribution with the lowest relative entropy is the 'closest' to , and therefore requires the fewest additional assumptions to reach.
We'd like to minimise this quantity, while also ensuring , and . We therefore have a constrained optimisation problem, so turn to the tool of Lagrange multipliers8, resulting in the Lagrangian
where I've simplified some notation and added arbitrary constants and . Proceeding by differentiating with respect to a particular ,
and re-arranging and renaming to different arbitrary constants we have
We know that is normalised, so we can write the normalisation constant out the front as
To get a feel for what represents, consider two schedules and that have and . Then
i.e. for every unit increase in , the probability of that schedule occurring is boosted by . Positive therefore increases the probability of schedules favouring the weakest contestant by boosting their average score .
The difference between and
Before we continue, it's useful to spend a little time discussing how the distribution of schedules () is related to that of win credits () - the former can be uniform while the latter is not. Define the distribution over like
i.e. the probability of a particular is the sum of probabilities over schedules that produce this score.
Consider a toy example with three schedules , each with uniform probability . Each schedule has a different score: , and .
The toy partition function is therefore
and the probabilities for look like:
Schedule
0
We can plot how these probabilities change as we vary , and how those changes affect the expected value of as it varies: . .
At , all probabilities converge. As it increases, weaker schedules become less prominent, and stronger ones more prominent.
As expected, higher means that stronger schedules have a higher probability of appearing, and so the expected score increases.
It's also helpful to express and in terms of rather than :
Turning back to the observed Taskmaster scores, we can plot our estimate of alongside an estimate of (constructed by drawing from with altered probabilities via inverse-transform sampling). A few things stand out:
is centred around the shuffled average as expected.
lies quite far from the centre of - this is helpful to know, as it quantifies the surprise we should feel at seeing a discrepancy this large.
To get the peak of to match , we need to increase to ~0.65
Try different values of to see how changes.
This is helpful! We now have a rough estimate . The next questions to ask: how sure are we of this value? Are the observed scores also compatible with ? But first, a quick hop back over the fence into the physics department. (They've got better coffee there anyway.)
Why
We choose to write here not because it's cool to use \mathcal{Z} all over the place (it is), but because this looks very much like a partition function9 from statistical mechanics. Continuing the analogy, we can identify as a microstate of the system, and as a measurable macroscopic property of the system. You might like to think of as the configuration of atomic spins in a magnet10 - completely unmeasurable by themselves. However the overall magnetisation is measurable, corresponding to our . By applying an external magnetic field, you can bias the probability distribution of the microscopic atomic spins towards particular configurations, manifesting in a macroscopic change to the measurable magnetisation.
In this sense, we can identify as a kind of editorial field - an external pressure applied to the system (task schedule) to modify an observable property (scores of weakest contestants). It has units of Taskmaster points, known as the Horne (Hn). At this point in our analysis we can conclude a rough measurement of a field strength of 0.65Hn, to my knowledge the strongest editorial field strength yet reported in the literature. An Ignoble is surely on the way!
Using
Let's look now at actually using to do something useful - finding which values of are most likely. We know the probability for given already, so we can write down the likelihood for given the observed :
Defining
then the log-likelihood looks like
Differentiating with respect to the first term disappears and so
Computing the second term we get the nice result that
i.e. the derivative of the log partition function is just the expected value of ! (This is why physicists love exponentials so much.) At maximum likelihood
i.e. at the optimal value of ( 0.65), the likelihood is maximised and the expected value of under this model is the one which we observe. This is exactly the procedure for the interactive plot above - we varied until .
To see that this is a maximum, we can differentiate again to uncover another delightful identity
which is always below zero since variance is a positive quantity.
Approximating
To better illustrate the discussion above, let's choose an explicit form for - a normal distribution with mean and variance :
The partition function is then
and hence the following identities for this model:
The plot below compares the normal approxmations for and - the former is pretty good, the latter starts to fail for far from zero as the assumption of infinite support for starts to fail:
The same plot as above, with normal approximations overlaid.
There's one final point to note that brings us neatly back round to physics again. Note that
The left-hand side is the 'response' of the system - how far the macroscopic property moves as a result of the application of a force . The right-hand side is the natural fluctuation of the macroscopic property in the absence of any force. This is then a manifestation of the fluctuation-response relation11 for this system - a relation observed in thermodynamic systems.
Does this observation ultimately justify the increasingly strained analogy of Taskmaster scheduling with a physical system? That you'll have to decide for yourself, reader.
Answering the question
Let's - finally - answer the question we posed ourselves long above: is it reasonable to conclude that a non-zero editorial force was applied to the Taskmaster schedules, gerrymandering the task/episode distribution?
To calculate a probability distribution for , we need to combine the computed likelihood from our data points with some assumed prior distribution . Once we know this, we can compute
You can try different below and see what probability we assign to - for the flat prior we get 97%.
Prior
Posterior probability distribution for given the observed task
scores and assumed prior.
To capture the spread of predictions of these models, the following plots the area of the shaded region above () and also the Bayes factor12 for each of the priors, parameterised by their relative 'spread' parameter and keeping the mean prior value of at zero. Loosely speaking, implies that the alternative model explains the data better than the null model.
Here we define the Bayes factor as the ratio of probabilities of observing under the different models (or hypotheses, hence the ):
(If the lack of integral in the denominator bothers you, you can imagine that we're integrating over the null model that there is no field, i.e. .)
Uniform
Normal
Student-t (df = 4)
Laplace
Comparison of models for - better models are brighter and to the
right.
Ultimately we observe some weak evidence under some priors that the editorial field is non-zero - - and reasonable evidence that if it does exist, it points in the positive direction.
So, success? 5 points for this analysis? Or would the Taskmaster take his usual dim view of over-eager contributions to the show and reward us with a swift nul points? I'm not sure we can derive that answer from observed data, so instead we'll have to wait until the inevitable series 23 and hope that the Horne field directs it's scheduling force towards tasks of a more statistically involved nature. Here's hoping!