šŸ‘‹ hi, Iā€™m basile

Machine learning's take on the Brexit's House of Commons

Let’s say things are a little confused over here in Brexit Land. To put it lightly, it has become difficult to explain, or simply to fathom what’s going to happen next.

A few months ago I looked at the rift splitting the Conservative Party, but the topic kept nagging me.

Obviously the “indicative votes” were a great tool to identify the Brexit “tribes," as they represented such varied opinions, allowing us to build a mental picture of the different kinds of Brexit MPs could support.

But paying close attention to British politics for a while introduces a certain perception bias, whereby we see some MPs as more or less extreme based on our impressions shaped over a few months discusssing the topic ā€” the quite questionable data we gathered by reading the news.

So here are my questions:

What about the long-term, more latent allegiances MPs might hold?

Could we do without our “Brexit goggles” and look at a more impartial, objective picture of our House of Commons?

To find out, I fed a number of House of Commons Brexit-related votes to t-SNE, a machine learning discovery algorithm. The result is below:

View on Observable

Note the clustering of Brexiteers at the top of the plot, including Labour’s Kate Hoey, the DUP, and Boris Johnson’s cabinet.

At the bottom of the Conservative cloud are the more moderate MPs and Theresa May’s cabinet. Former prime minister Ken Clarke is placed close to Sir Oliver Letwin (author of prominent amendments allowing the House to wrestle control from the government) and Dr Philip Lee, who defected to the Lib Dems.

Kit Malthouse, author of the “Malthouse compromise” which gathered support from both sides of the Conservative benches, is in the middle.

A word on the data

The dataset is comprised of 238 votes, including amendments and draft bills, “meaningful” and “indicative” votes (on Theresa May’s deal and on a range of freely-submitted, blue-sky-thinking options respectivelly), as well as procedural votes and motions (such as Sir Oliver Letwin’s two successes at wrestling control of parliamentary agenda away from the executive branch).

These votes took place between September 2017 and September 2019, and I must thank the Institute for Government, who have provided the overwhelming majority of this research labelling Brexit-related votes from two years' worth of votes.

As for the previous Reuters piece, I scraped the Parliament API to obtain each vote cast by each MP in each House of Commons vote.

The t-SNE algorithm took into account how MPs voted (in favour or against a bill) and whether they voted at all (MPs are not bound to cast their vote, and some occasionally abstain).

These numerous variables were reduced by the algorithm to two dimensions for visualisations (x and y). Contrary to a principal component analysis (see The Economist piece below), it is not possible to say what t-SNE has seen (so to speak) in a dataset.


  1. The Economist’s MP’s Brexit votes reveal myriad divisions among the Tories, based on 13 votes including the indicative and meaningful votes and on principal component analysis.
  2. The Institute for Government’s continued excellent research and timely analysis of British politics.

#observable #d3 #viz