Democracy in Data: What an Unsupervised Algorithm Found — and Why It Matters Now
Democracy in Data: What an Unsupervised Algorithm Found — and Why It Matters Now.
The algorithm found 2016. I didn’t tell it to look: I gave it unlabeled numbers — no country names, no dates, no political context. Just democracy scores for 195 countries. It organized them into four clusters. Then I looked at the US trend line and saw a drop I hadn’t told the algorithm to find. The drop was in 2016. And it never recovered.
I am a data engineer, not a political scientist. What follows is not a political argument. It is a data story. I built a machine learning system that analyzed democracy scores for 195 countries — then extended the analysis to the 167 where internet freedom data also exists. I gave the algorithm no labels, no context, no knowledge of history. Just numbers. And what it found — quietly, mathematically, without opinion — is worth paying attention to right now.
What Is Unsupervised Machine Learning?
Most people understand machine learning as a system that learns from labeled examples. You show it thousands of photos labeled “cat” or “dog,” and it learns to tell them apart.
Unsupervised learning works differently. There are no labels.
You give the algorithm raw numbers and say: find me the patterns. It has no idea what the numbers mean. It doesn’t know the names of the countries. It doesn’t know what year it is. It doesn’t know anything about politics. It just looks for structure.
That is what I did with democracy data. And what the algorithm sorted — without knowing any of it — turned out to map almost exactly onto the political patterns experts have spent decades defining.
The Data: What We’re Actually Measuring
The Economist Intelligence Unit (EIU) Democracy Index scores countries annually across five dimensions, each on a scale of 0 to 10:
| Dimension | What It Measures |
|---|---|
| Electoral Process & Pluralism | Are elections free, fair, and competitive? |
| Functioning of Government | Do institutions work? Are there checks and balances? |
| Political Participation | Do citizens engage? Does voting matter? |
| Political Culture | Do people believe in democracy? Are transitions peaceful? |
| Civil Liberties | Can people speak freely, assemble, access justice? |
Here’s the critical point: I removed all the labels before giving the data to the algorithm. No categories. No regime types. No country names. Just 195 rows of five numbers each. Then I asked: what do you see?
What the Algorithm Found
Using K-means clustering — validated against hierarchical clustering and Gaussian Mixture Models — the algorithm organized 195 countries into four distinct groups. When I put the labels back and compared, the alignment was striking.
The largest cluster — 66 countries — sits in the gray zone between democracy and authoritarianism. Not because I said so. Because the data placed them there.
Which Dimensions Drove the Clustering
Not all democratic dimensions were equally important. The algorithm revealed which aspects most strongly differentiate political regimes:
What a Healthy Democracy Looks Like in Data
The algorithm places Norway firmly in the top cluster with an overall score of 9.81. Nearly perfect across all five dimensions. Now look at the United States.
The mechanics of American democracy — the ballot box, the right to vote, the formal legal protections — score well. What scores poorly is the culture around those mechanisms. The shared belief in democratic norms. The willingness of political elites to accept outcomes. The functioning of institutions designed to check power. The algorithm placed the US in a different cluster than Norway not because of elections. Because of what surrounds them.
Where the Data Breaks
The line holds at 8.05 through 2015. Then in 2016, it drops. And it never fully recovers. The US crossed below the Full Democracy threshold of 8.01 in 2016 and has stayed below it since.
The algorithm didn’t know about 2016. I didn’t tell it. It just saw the numbers change.
We know what happened in 2016. The Senate Intelligence Committee found that Russia probed election systems in all 50 states and ran a large-scale influence campaign designed to amplify division. Cambridge Analytica harvested the profile data of 87 million Facebook users and used it to build psychographic models for micro-targeted political messaging.
Neither effort primarily attacked the ballot box. Both primarily attacked Political Culture and Functioning of Government — the two dimensions where the US scores weakest.
The unsupervised algorithm, seeing only numbers, drew a line at 2016. Not because I told it to. Because the data said so.
The Surveillance Gap: Adding a Sixth Dimension
The original analysis used five dimensions from the EIU. But a question kept surfacing: what about countries that look democratic on paper — but control the information environment their citizens live in?
Hungary has elections. India has elections. Turkey has elections. By traditional democratic metrics, all three score in the Flawed Democracy range. But all three have significantly restricted internet freedom and used digital infrastructure to monitor dissent. The EIU’s five dimensions weren’t built to capture this.
Of the 195 countries in the EIU dataset, 167 have corresponding Freedom House internet freedom scores. Those 167 became the dataset for the extended analysis. I merged the EIU Democracy Index 2024 with Freedom House’s Freedom on the Net 2025 and ran the clustering again with internet freedom as a sixth dimension.
The algorithm found four new profiles — what I call digital governance clusters:
| Cluster | Defining Pattern |
|---|---|
| Digital Democracies | High democratic score + high internet freedom |
| Constrained Democracies | Democratic institutions, restricted digital space |
| Digital Hybrids | Mixed governance + selective digital control |
| Hard Authoritarians | Low democratic score + heavily restricted internet |
The Digital Hybrids cluster is the most important finding. These are countries that appear democratic when you look at elections and formal institutions. But when you add internet freedom, the algorithm separates them from genuine democracies. Using SHAP explainability — a technique that identifies which features drove each classification decision — the dominant features for Hungary and India weren’t electoral process. They were internet freedom and political culture.
The distance between a country’s formal democratic score and its internet freedom score. A country can claim democratic values while building digital infrastructure that enables population monitoring at scale. The higher the gap, the wider the distance between what a government says about democracy and what it does with data.
Governance Frameworks Are Falling Behind
The surveillance gap is not a theoretical concern. It is an active policy problem.
Recent debates between AI companies and governments over the permissible uses of large language models — particularly around mass surveillance capabilities and autonomous decision-making systems — illustrate how quickly technological capability is outrunning governance frameworks. When AI can aggregate commercially available data on citizens’ movements, associations, and online behavior at a scale no existing privacy law was designed to govern, the question this analysis keeps asking becomes urgent:
The Digital Hybrids my algorithm identified are not full authoritarians. They are something more subtle — democracies whose digital infrastructure has outpaced their democratic commitments. The formal institutions exist. The information environment around them is being shaped. That gap — between democratic claims and digital reality — is precisely what governance frameworks are now being asked to close.
That is what engineers who understand both systems and stakes can contribute.
Explore the Analysis Yourself
Every country. Every dimension. Every cluster. See where the US sits relative to Norway. See where Hungary and India land when internet freedom enters the picture.
Live Interactive Dashboard GitHub RepositoryWhat to Take Away
This piece started as a grad school project. I gave a machine learning algorithm unlabeled data and asked it to find patterns in global democracy scores. It found four clusters. It placed the US below the Full Democracy threshold. It drew a line at 2016.
I extended it because the original five dimensions weren’t enough to capture what is actually happening to democratic health in the digital age. I added internet freedom. The algorithm found a new category — Digital Hybrids — for countries that look democratic on paper but control the information environment their populations live in.
Then the world caught up.
The questions this analysis raises are not hypothetical anymore. Who gets to set limits on how AI systems are used for surveillance? What does democratic health look like when the information environment is controlled at scale? How do we measure the distance between what a government claims about democracy and what it does with data?
These are engineering questions as much as political ones. And engineers who understand both the technical systems and the democratic stakes are exactly what this moment needs.
I am not drawing political conclusions.
The data already drew them. I just learned how to read it.