Global Happiness Predicted by Spotify Trends

About this Project

My music taste varies depending on my relative happiness.
My close friends and family can predict the state of my happiness by seeing my recently played on Spotify.
So, I was curious if this analysis can work on a larger scale: predicting the happiness level of a country based on their music trends.
If music trends are correlated with different happiness levels, the results could be beneficial to predict or diagnose issues a country is facing by inspecting the music taste of its citizens.

Happiness Analysis

Process:

To begin, I downloaded the world happiness data from Kaggle. This data source included information about each country’s Happiness Score and different factors that affect it for 2015–2019.

Findings:

Music Analytics

Process:

This part proved to be harder than expected because Spotify’s API no longer has extractable on the top charts by country or provided an easy way to extract music analytics by song name. So, I had to web-scrape each Spotify top 200 chart by country and date.

Connection between music and happiness

Initial Findings:

First, I ran a linear model on the data base containing 30,000+ song entries by country and their happiness score. The goal was to analyze which factors of a song were the most significant in determining a countries happiness score.

Building a prediction models for happiness:

Using the database with the top 30,000+ songs across the world, I built a prediction model to analyze if the country that listened to it had a happiness above or below the mean.

  • If all predictions were filled with with “1” the base accuracy was 57%
  • However, if we used the prediction model to assign 0s and 1s based on music taste, the accuracy level increased to 95.67%
  • If all predictions were filled with with “1” the base accuracy was 25%
  • However, if we used the prediction model to assign values of 1, 2, 3, 4 based on music taste, the accuracy level increased to 50.4%

Conclusion

Music was shown to be a powerful predictor of the overall happiness of a country. We can understand a lot about a population based on what music they are listening to.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store