Spotify using TensorFlow - machine learning to suggest music and playlists!

Spotify uses TensorFlow machine learning for suggestions

Published on by Roshan Jonah

You ever wondered how Spotify is so accurate in predicting your mood and suggesting just the right songs for the occasion? Wonder no more as we reveal how they do it. We have long heard of recommender systems which work by finding similarity and suggesting the most similar ones. In situations like this, recommendations are usually not objective as they are not dependent on people’s tastes and mood based on songs they were listening to before. Back in the day, this meant it was impossible to create a highly personalised playlist based on an individual listener. Spotify puts out a “discover weekly” playlist which became their flagship offering. It was so good that people loved the service for it. Every Monday, it put a smile on millions of people from the fresh new playlist of songs it generated for them. It used different data aggregation and sorting methods to create this recommendation model that is powered using what we call machine learning. They use three forms of recommendation models to power this “discover weekly” playlist.

1. Collaborative filtering model

This is a popular technique used by recommender systems to automate predictions based on user preferences and similar users. The collaborative filtering model compares thousands of user-created playlists that have songs that the user has listened to. The algorithm then combines those playlists to look at other songs in the playlist but haven’t been recommended yet. This computation is executed by matrix math - creating a matrix of all the active users and songs. Then it runs a series of complex factorisation formulae, which separates two vectors where x is the user vector representing the taste of an individual user and Y is the profile of a single song on the playlist. To compute a user with similar taste, the collaborative filtering model compares a given user vector with every user vector. This same logic is also applied to song vectors.

2. Natural Language Processing

This is where the computer understands speech and text in real-time. Spotify’s crawler goes around the world wide web to find articles, blog posts, and any other resources relating to music to develop a profile for each song in their offering. All this data is fed into a natural language processing algorithm to classify songs based on the language used to describe them. It can then match them with other music that is similarly described. Artists and songs are assigned keywords based on their data, with varying weightage given to each keyword. A vector representation of the music is created, which is then used to suggest similar songs.

3. Convolutional Neural Networks

These are used to sharpen the recommendation systems to help achieve greater accuracy in suggesting songs. This is helpful because it allows less popular songs that other models would otherwise neglect to be picked up. So if there were new song releases, this technique helps in picking them up for consideration. Traditionally, convolutional neural networks are used for facial recognition, but Spotify has developed these models for song suggestions. Each song raw audio is taken in as waveform and processed by CNN by assignment of crucial parameters such as beats per minute, major/minor key used, loudness, rhythm, etc. Spotify then tries to match similar songs with the same parameters to the one the user is listening to.

The biggest problem with machine learning models is the lack of access to clean, structured data that can be utilised and processed effectively. Spotify overcame that due to their large user base and constant collection of diverse data that allowed them to personalise experiences for their customers.

Do you want to personalise experiences for your customers?

Fascinated with machine learning - talk to our AI experts, and we will help you revolutionise the way you do business.
No Obligations. 📎 No Hidden Charges. 💸 No Strings Attached. 💣

Learn more!

Roshan Jonah

I am a Son, Brother, Friend, Jesus Lover, Entrepreneur, Blogger, Software Developer & Designer. I work under Jonah & Associates. I love simplicity & creativity. I am a big fan of technology and I am fascinated about Artificial Intelligence!

If you liked it, please 📣 share and 💬 comment!