Playlist Harvesting 

word2vec + music

A Call to Arms

Computers aren't making playlists anywhere near as good as those created by humans. David Byrne recently wrote that A Great Curator Beats Any Big Company's Algorithm and he is most probably right.

Big music companies are hiring human DJs to create playlists instead of relying on computer algorithms. Beats started the trend, now Apple Music and Rdio are taking it to the next level. 

This trend toward human curation comes at a time when music discovery is becoming more important than ever as subscription music services go mainstream. As Byrne noted "when everything is available, within reach, accessible, the problem becomes not one of scarcity but of abundance." 

For music hackers, this is a call to arms. We need to understand the limitations of existing software and harness the strengths of human curation to develop new methods.

For the past few weeks I have been playing with a new technique that might deliver better results. 

Humans Do It Better

The reason two songs may be considered similar enough to appear together on a playlist is surprisingly complex. They might be similar if they were performed by the same artist, use the same group of instruments, played at the same tempo or sung in the same key. They might be similar if they are are listened to by the same type of people or even if they appear in the same hit movie. 

Using computers to model and measure these different similarity features is a hugely difficult task. Yet human experts intuitively understand song similarity. They can effortlessly create playlists that blend songs together perfectly. 

In the near term, we might get better results by harvesting the fruits of human intelligence rather than trying to emulate it.

Logic

Harvesting human curated playlists will create better algorithmic playlists.
Two songs are similar if a human says they are.
They are similar if a human has put them together on the same playlist. 

Music is a form of communication just like language, songs are like words and playlists are sentences. Just as a sentence combines words to communicate meaning, a playlist combines songs to communicate feeling.  

If we convert playlists to sentences we can experiment with the latest machine learning models built for text processing and see how they perform with music.

Algorithm

Word2Vec is a Neural Network Language model developed by Tomas Mikolov and other engineers at Google. It was released as an open source project in 2013. 

The model is capable of organizing concepts based on their distributional similarity without receiving prior instructions about the manner in which these concepts are related. It creates meaningful representations of words that captures both syntactic and semantic information of a word.

Word2vec should be a great tool for modeling the similarity of songs on playlists. 

Nevyana Boycheva from Tilburg University published a paper in January 2015 comparing word2vec with Spotify. She concluded that "despite its relative simplicity the distributional similarity recommender system is capable of overcoming some of the disadvantages of a commercial system like Spotify in terms of the investigated metrics of novelty and diversity but not in terms of serendipity."

Promising enough to explore further methinks. 

Application

To test the idea, I collected 100k Spotify playlists via Twitter search. This provided a dataset of about 70k artists and nearly 600k songs. I used the Gensim implementation of word2vec on a Digital Ocean Django stack. Playlists were converted to sentences with song meta (artist_name or song_id) as words and used to train the word2vec model. 

The results are surprisingly good with very little effort. Good enough to power a pretty cool playlist engine.

You can try it out yourself here:

http://popgun.me/x?q=the+shins

Enter artist names to get a playlist based on that artist.

You can enter multiple artists comma separated like 'Bob Dylan, Donovan, Scott Mckenzie'

http://popgun.me/x?q=bob+dylan%2C+donovan%2C+scott+mckenzie

You can add a minus sign in front of a name to move the vector space away from that artist like 'Madonna, -Cyndi Lauper' creates a playlist inspired by Madonna but not from the 80s.

http://popgun.me/x?q=madonna%2C+-cyndi+lauper

As well as artists, you can also create playlists based on genres, emotions and activities or a blend of each. A list of supported tags are here:

http://pastebin.com/raw.php?i=ygtnDAbA

Benefits

The technique has some interesting properties.

• It is super fast to train and suggest. It would work well in a real-time environment learning from user playlists as they are published.

• It is very efficient and should scale to huge datasets. The more data, the more nuanced the engine should become reflecting different song contexts.

• Playlists can be combined with richer textual information such as liner notes and artist bios for even deeper context.

• It uses a vector space model, so simple algebraic operations on vectors will create interesting playlist variations. For example, Madonna - Cyndi Lauper + Katy Perry should move the playlist away from 80's toward more modern releases.

• It is a very simple model to code with. It is a great tool for startups building recommendation engines.

Talented music hackers with access to large playlist datasets will produce amazing results that outperform existing playlist engines.

Enjoy!

Stephen Phillips
@huntedguy
July 8 2015

About Me

From 2009 I led a music startup called We Are Hunted. It was one of the first music charts powered by social media and was a popular tool for music discovery. It was later acquired by Twitter in 2012. I worked on Twitter Music in 2013/2014. Since leaving Twitter I've been thinking a lot about new models for music discovery. This story is part of a series I am writing exploring the past and future of music app design. 

Discover New Music

If you love hearing the latest new music before anyone else, check out Wonder.fm which I built with my friends at Hydric Media. Wonder.fm monitors the most popular new songs posted to SoundCloud each day.

References

word2vec Project
https://code.google.com/p/word2vec/

Efficient Estimation of Word Representations in Vector Space
http://arxiv.org/pdf/1301.3781.pdf

Distributional Similarity Music Recommendations Versus Spotify: A Comparison Based on User Evaluation - Nevyana Boycheva
http://arno.uvt.nl/show.cgi?fid=136352

http://mfcabrera.com/research/2013/11/14/word2vec-german.blog.org/
http://www.quora.com/search?q=word2vec
http://deeplearning4j.org/word2vec.html
https://radimrehurek.com/gensim/models/word2vec.html
https://unsplash.com/jordaneil (title image)
https://en.wikipedia.org/wiki/David_Byrne