Back to all writing
AI and Society10 min read

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.

Before we begin

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.

Part One — The Analysis

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.

Think of it like handing someone a stack of 195 portraits of strangers and asking them to sort the photos into groups based only on facial features — without telling them anything about the people. Whatever groupings emerge, they emerge from the data itself, not from assumptions.

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:

DimensionWhat It Measures
Electoral Process & PluralismAre elections free, fair, and competitive?
Functioning of GovernmentDo institutions work? Are there checks and balances?
Political ParticipationDo citizens engage? Does voting matter?
Political CultureDo people believe in democracy? Are transitions peaceful?
Civil LibertiesCan 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.

What the algorithm found — 195 countries, no labels
K-means clustering · ARI vs expert classifications: 0.78 (hierarchical), 0.57 (K-means)
39
Liberal democracy
High electoral integrity, strong civil liberties
41
Participatory democracy
Strong civic engagement, moderate institutions
LARGEST
66
Hybrid regime
Mixed democratic and authoritarian features
21
Electoral autocracy
Controlled elections, weak civil society
The algorithm received no labels, no country names, no political context — only numbers. The clusters it produced matched expert regime classifications with an Adjusted Rand Index of 0.78.

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:

Feature importance from clustering sensitivity
Higher = stronger regime differentiator · Note: US scores 6.43 and 6.25 on the bottom two
Civil Liberties0.90
Electoral Process & Pluralism0.86
Functioning of Government0.75 ⚠
Political Culture0.72 ⚠
Political Participation0.64
⚠ The US scores 6.43 on Functioning of Government and 6.25 on Political Culture — the two dimensions most responsible for placing it outside the Full Democracy cluster.
US vs Norway

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.

US vs Norway — by dimension
Scale 0–10 · EIU Democracy Index 2024
United States (7.85 — Flawed Democracy) Norway (9.81 — Full Democracy)

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.

The 2016 Finding

Where the Data Breaks

US Democracy Score — 2015 to 2024
Full Democracy threshold: 8.01 · Source: Economist Intelligence Unit
US score Full Democracy threshold (8.01)

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 goal was not to change vote tallies. It was to erode trust in institutions, fracture shared norms, and make democratic culture brittle. The EIU data, scored by independent analysts who had no knowledge of my analysis, captured exactly that erosion — in the same year it happened.

The unsupervised algorithm, seeing only numbers, drew a line at 2016. Not because I told it to. Because the data said so.

Part Two — The Extension

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.

Analysis Architecture
Part 1 — Traditional (195 countries)
· Electoral Process
· Functioning of Government
· Political Participation
· Political Culture
· Civil Liberties
→ 4 Regime Clusters
+
Part 2 — Digital Extension (167 countries)
· All 5 EIU dimensions
+ Internet Freedom (Freedom House)
→ 4 Digital Governance Profiles

The algorithm found four new profiles — what I call digital governance clusters:

ClusterDefining Pattern
Digital DemocraciesHigh democratic score + high internet freedom
Constrained DemocraciesDemocratic institutions, restricted digital space
Digital HybridsMixed governance + selective digital control
Hard AuthoritariansLow 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 Surveillance Gap

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.

Why It Matters Now

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:

How do we measure the distance between what a government claims about democracy and what it does with data?

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 Repository

What 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.

Rosalina Torres is an MS candidate in Data Analytics Engineering at Northeastern University’s EDGE program, graduating August 2026. Her research interests are at the intersection of machine learning systems, data governance, and the human contexts that data reflects. She is actively seeking ML/AI engineering roles.

Data sources: Economist Intelligence Unit Democracy Index · Freedom House Freedom on the Net 2025
Analysis: Python, scikit-learn, XGBoost, SHAP · All findings are the author’s own and do not represent Northeastern University.

Read nextThe Future of Learning Is Here: What Are We Going to Do About It?