What does your Spotify music sound like? Data Science with Spotify (Part 1) | by Alvin Chung | Towards Data Science

Music has always been an integral part of everyone’s lives. We hear music, if not listen to music where ever we are, the melodic sounds when we are studying, the exhilarating thrills and beats when we’re at parties and the exciting and fun car pool karaokes we have with our friends when traveling. Music is everywhere around us.
What if we could analyze the music we listen to using Data Science derive insights on the types of music we listen to?
The motivation of this series is to enable anyone to discover patterns and insights about themselves and the music that they listen to. In doing so, gain a greater understanding of the musical behaviors they have when listening to Spotify.
Note: The code to collect data and perform insights on your own music is linked below.
To achieve this we will aim to show a full end to end cycle of deriving a Data Science Project quantitatively, and will be sectioned into the following.
Here we will learn the basics of statistical analysis. This gives us an understanding of the data we are working with and derive insights on the features we have. Exploratory Data Analysis is often the most essential step of any Data Science project as it provides a great deal of insight towards building further analytics.
What sort of music styles are often featured on Spotify? Is the music that is featured often more acoustic?
What are the sorts of music we might enjoy?
Do the most popular songs charting, follow some sort of pattern?
In this section, we will learn to place some statistical rigor towards our observations that we made in our data visualizations. After all, we want to quantitatively verify our hypotheses. Some statistical tests, we will perform are the Chi-Squared Good fitness, and T-testing, as well as a look into correlation.
Here, we will look at understanding how to perform A/B testing in answering questions about our music tastes, such as:
- Does the style of music I listen to differ from those that are played in the top 100 and different from those featured on Spotify.
What styles of music do we listen to that might be more pronounced that the typical music featured on Spotify
Lastly, Are we generic? Meaning, do we listen to music that follows a similar pattern when compared to the most popular songs.
This last part will use the insights we made from both Exploratory Data Analytics and A/B testing in developing a Machine Learning algorithm which suggests us new songs!
What styles of music is often featured on Spotify? Is the music that is featured often more acoustic? What are the sorts of music we might enjoy? Do the most popular songs charting follow some sort of pattern?
One of the greatest aspects of Data Science is the ability to concentrate large scales of data into a single piece of information. This enables us to answer questions we might have and gain a greater understanding of our individual behaviors, and the types of music we enjoy.
An essential part of Data Science is to understand the distributions of the data we have collected. We care about the distributions as it provides us insights on the frequencies of the various styles of music, as well as the shape of the frequencies as if they were on Spotify. Let’s start by look at the distributions of songs featured on Spotify!
Through observing the distribution plot, we can immediately observe the following:
There is a very heavy slope downwards in the features speechiness and acousticness, which we can note a slight up-tail in the distribution near the end of the plot. This indicates to us that the music styles of songs featured on Spotify are in general less acoustic or speechy. The uptail indicates to us, that songs with high speechy or acoustic are more likely to be selected near the upper-bound.
Or more quantitatively, styles of songs rated to be more than 25% acoustic or speechy are less likely to be featured on Spotify.
Most songs featured on Spotify are often not very lively, and as the liveliness of the song increases, the likelihood of it being featured on Spotify decreases.
Danceability appears to normally distributed with tails of the distribution featuring lower likelihoods of being featured on Spotify.
The attributes, Valence and Energy appear to be approximately evenly (uniformly distributed). Indicating no preference for those attributes affecting the selection of music featured on Spotify.
In sum, songs featured on Spotify tend to exhibit low acousticness, speechiness and liveness with valence and energy showing no notable impact on a song being featured on Spotify. Finally, songs approximately 65% Danceability are most commonly featured on Spotify.
Knock Knock, who’s there? What sort of music style is this, It’s so good! Well let’s find out!
Music tastes can be a great reflection of our emotions and feeling. They provide us an identity, a feeling of security, and more often than not, a melodic tune which ebbs and flows alongside our daily lives.
When we are feeling amazing! We’ll listen to music that feels like we’re on the top of the world! And when we suffer from a heart break, we will listen to songs that reflect the loss of a loved one. This introspective view of our lives, can actually be encapsulated in the music we listen to!
So let’s see what we can find from inspecting my favorite songs as of current!
What we can observe from the graph above are the following:
The songs I listen to are quite normally distributed in acousticness, valence, danceability and energy.
We might note that the distributions for liveness and speechiness to be concentrated on the lower-bound suggesting that the music I listen to is not very lively nor speechy.
We can observe that I tend to enjoy music which is more acoustic, danceable and energetic. With a low preference for music that are lively or speechy.
Bob why is your music so generic! It’s because their is no significance is your taste. hue hue hue
The top 50 songs charting are undoubtedly the most prolifically played throughout the world, whether you listen to it when shopping for your new bag, or listening to it in the background when having a conversation with your friends at a cafe. It is everywhere around us. But, we never seem to mind listening to these songs, they may get bland in some cases as our ears adjust to the music. But never do we say “Man I can’t stand listening to this song, It hurts my ears”, why is that?
Is their a sort of pattern which the top 50 songs adopt that allows us to enjoy the song playing in the background and even sometimes, sing along to it?
We’ll achieve this through plotting a box-plot for each one of the styles of music in the top 100!
By observing the box-plot, we can see that most songs that are charting in the top 100 are:
Highly danceable and energetic. But low in acousticness, speechiness and liveness
Songs in the charting in the top 100, exhibit high preference for songs which are very much danceable, and low in speechiness. For instance, Middle by Zed, Happier by Marshmello.
I hope you all very much enjoyed the insights derived through visualizing the top 100 charting songs, featured songs and my personal favorite songs on Spotify!
If you would like to try this for yourselves and have a look at your own Spotify tastes and try to do this yourselves, I've attached the link to the code I've used to collect this data here
If you really liked this article, please do 👏 and share it with your friends. This will let me know you guys really enjoyed this first of a series, and I’ll look to continue doing more if that is the case. Remember, you can clap up to 50 times — it really makes a big difference for me.