Have you ever wondered how “trendy” your taste in music is?
I think about it all the time, but Spotify makes it impossible to compare my playlists to others.
That’s where my Spotify Scoring Algorithm comes into play.
Using Python, a lil bit of SQL, and my magical math skills, I wrote a program that uses the following equation to score a user’s taste in music…
Here are the questions I’m answering for you in this project report:
Click here if you wanna see the code I wrote on GitHub
I used Spotify’s API to retrieve data from my favorite personal playlist: Canciones en Español. Using the various popularity metrics Spotify gives you, I created an algorithm that scores my taste in music on a scale from 0 to 100.
I’m a massive fan of Latino Music and songs in Spanish. But most people I know don’t have the same musical passions as me. While browsing through Spotify’s API documentation (you know, just some light, fun reading), I discovered the popularity metric their own algorithm created.
I realized there was a way to take advantage of this data to create my own equation that finds my answer for me.
I could have easily just taken the 439 track popularities on my playlist, find their average, then call it a day.
Boom!
That would only take five minutes. Nice and easy.
But some songs and artists deserve to hold more or less weight in the scoring algorithm based on specific factors I found important.
Here they are:
This project took me around two weeks to complete, and in case you’ve never read my other blog posts that talk about this experiment, this is my first big Python project.
Yup, that’s right.
I’ve only been learning the language for about one month. But hey, I’m a quick learner.
Anyway, here are some of the valuable skills I picked up while creating this Spotify algorithm:
Since this was my first big Python project, it’s inevitable that challenges popped up out of nowhere and slapped me silly across the face.
Even though I have a long way to go before becoming a true Python master, I lied a bit when I said I’d only been learning it for one month. In college, I took a few programming classes with Python and learned a lot.
But that was 3+ years ago.
I forgot a lot over time, but the fundamentals stuck with me and made it easier to understand concepts.
One of the biggest challenges I faced came in the form of greed.
I started having fun creating the scoring equation and tried doing too much. My original plan was to standardize the track/artist popularities to make the scoring system fair and account for outliers.
But one big mistake made me its slave…
The standardization formula I used created a bias, where popularities were compared based on their standard deviations instead of their size.
Once I realized this, I scrapped the idea and focused on comparing the raw popularity scores.
Now that I’m free and finished with this project, part of me wants to run away and never think about Spotify again.
But that’s not happening.
Anyway part of me also wants to dive back into the project to optimize my code.
Here are a few things I would do differently if I started the project today:
This project is just one of many that’ll put my programming and data science skills to the test. Starting off with a project this grand seemed impossible at first.
But finishing the project is like running a sub-four-minute mile…
Anything’s possible now.
And I almost forgot the most important part about this project….
From 0 to 100, how does my algorithm score my taste in music?
Well, drumroll, please……….
74/100
Not bad?
I’m not sure. I’ve gotta run some more tests and experiment with other playlists to find where the true mean and median sit.