You are here

Identify Spotify Music Genres with Google Prediction, Clarifai API

Deep Learning has been used in music recommendation services on Spotify, as well as in the image recognition capabilities of start-up Clarifai, where the algorithms learn from each output to continuously improve accuracy. In this tutorial by Alexandre Passant, he applies the Spotify Web API to Clarifai’s Deep Learning API and Google Prediction API to identify music genres from Spotify albums covers.

Deep Learning is the area of Machine Learning with the objective of bringing Machine Learning closer to one of its original goals; Artificial Intelligence. Where Machine Learning usually focuses on a single class to make sense of data by generalising from examples, Deep Learning uses multiple levels of representation and abstraction to build an understanding of data such as text, images or sound.

The tutorial starts with a simple Python class which queries the Spotify Web API to get an artist’s top-10 album covers, which are passed to the Clarifai API to extract tags. A similar process is performed on over a hundred tracks from each of two unrelated genres (K-pop and Doom-metal). With a list of tags representing each genre, these are fed into Google Prediction API which predicts an output value for a set of features using a simple training set applied to different models.

The author then applies SpotiTags to query the Spotify API and get the artist top-10 albums and pass them to Clarifai to build the artist tag-set. The tag-set is then passed to Google Prediction API to predict the class based on the former models. A third genre is added after this with notes on improving accuracy by focussing on genre-specific tags, rather than general ones that often overlap.

All relevant links and some sample code are provided as this tutorial shows a limited example of how Machine-Learning-as-a-service (MLaaS) can be applied to simplify tasks for developers in a possible step towards the no-stack start-up.

Be sure to read the next Machine Learning article: How to Perform Sentiment Analysis on Web-Scraped Data

Original Article

Identifying music genres from Spotify album covers using Clarifai’s deep learning API and Google Prediction