Imagine that one day you're watching the news with your friend and this politician who you don't know pops up on the TV. "Who's Kirsten Gillibrand?" you ask your friend. "What does she believe?"

"Oh, well, she's sorta like Elizabeth Warren," your friend might answer. Now, while this is obviously oversimplifying things, there's some truth here. Kirsten Gillibrand is definitely more like Elizabeth Warren than like Ted Cruz. But how would you even begin to compare the two?

For starters, you could look at voting records. See what percentage of policy issues these two politicians agree on. But what if what you want to go further than individual politicians and understand groups of politicians? And maybe even identify clusters and voting blocks between them.

Well, you could use this neat machine learning algorithm called principal components analysis (PCA). Here, we use PCA to find the two most significant variables that influence how senators vote. We can then use this information to visualize naturally arising groups of politicians with similar behaviors and beliefs.

The most obvious cluster is political party--no matter the issue, our senators appear to be deeply partisan. But if you look closer, you'll find a few other interesting clusters, like a small group of democratic-socialist-leaning politicians around Bernie Sanders.

So go ahead, play around and see if you can find a few other interesting trends!

Share this project:
×

Updates