Mary Rose Cook

Creating a music recommendation engine

I have spent the last six weeks writing a music recommendation engine, theperceptron.com It was fun.

From the user’s perspective:

  1. Enter a band you like.
  2. Get recommendations for other bands you might also like.
  3. Test out the artists recommended by visiting their Myspaces and websites, reading their Wikipedia summaries and listening to sample tracks.
  4. Say whether you like or dislike your recommended bands.
  5. Add promising bands to your playlist so you can listen later.
  6. Suggest an artist or two that the site didn’t recommended.
  7. Get on with your life.

From the code’s perspective:

Recommendations are made based on connections between artists. These connections are found in data taken from the internet:

  • Recommendations made by actual humans: tinymixtapes.com and epitonic.com and users of the perceptron.
  • Artist admiration: artists’ top friends on Myspace.
  • Artists on the same mixtape: muxtape.com
  • Artists on the same record label: wikipedia.org
  • Artists posted to the same mp3 blog: hypem.com
  • Artists who have played gigs together: myspace.com

Each rating action that a user can perform on a recommended artist - liking or disliking, visiting websites, listening to songs or adding them to the playlist - is associated with a certain number of points. These points are used in two ways. First, each source has a running total of points given to the recommendations made by the source. Second, each artist connection has a running total of the number of points it has accrued.

Recommendations are given a score based upon these point totals. Ignoring the weightings of the source and connection score, a recommendation’s score is calculated thus:

score = (source_points + connection_points) / num_source_connections

the perceptron’s algorithm is pretty obvious. What makes the site good is the choice of data sources. However, the algorithm does allow experimentation with adding data sources. If I add a bad one, the scores given to its recommendations drop very rapidly. It only took about 200 user rating actions to get the site’s data source weights pretty good. Here is the current table (higher numbers are better):

Source Score
Epitonic similar artists 0.439
Tiny Mix Tapes similar artists 0.316
Myspace top friends 0.128
Mixtapes 0.075
Record labels 0.020
Epitonic other artists 0.016
MP3 blogs 0.003
Gigs Score hasn't settled, yet.
the perceptron user recommendations Score hasn't settled, yet.
 

the perceptron

the perceptron is not a music recommendation website. It is a giant, bmx-riding, AIWA-headphoned, sunglassed, could-totally-get-an-A-in-maths-brained robot that processes the musical internet, notes your every move, and then plays you music you will fall in love with.

 

When you come to the end, you go back to the beginning

[In this post, there are lots of spoilers for The Wire. If you haven’t seen all five series, go and watch them.]

Lester Freamon in The Wire: “We’re building something here, Detective. We’re building it from scratch. All the pieces matter.”

The writers on The Wire occasionally let their characters say what it is the programme is driving at.

David Simon, the creator, has said that The Wire is about the way institutions affect people’s lives1. He has also said the programme is modeled upon Greek tragedies2, and as he noted, Grecian tragedy is obsessed with fate. If you combine these three insights, you come up with something magical: a piece of art that simultaneously champions two opposing views. In the case of The Wire: that every piece matters, and that the characters are fated.

For the characters, they are fated. Their personalities dictate what they will do when placed in circumstance. For the viewer, every piece matters. They do not have a complete picture of the characters’ personalities. Thus, they cannot predict what the characters will do in each situation until every personality facet has been revealed.

This contradiction is illustrated by Jimmy McNulty’s progression through Series 1. McNulty takes pride in his work and refuses to let police politics or his home life get in the way of his work. This means that when his superiors become concerned that his indictments will start riling their superiors, he continues his investigation. At the end of the series, this leads to him being exiled to a dead-end detail in the Baltimore port.

However, there is an extra subtlety: people can be beholden to zero or more institutions. Can the characters in The Wire choose the institutions to which they belong, and thus have a choice in their fate?

By the end of Series 3, McNulty has had enough of detective work and become a beat officer. This allows him to join the institution of marriage by moving in with Beatie Russell.

Thus, at the end of Series 3, McNulty withdraws from one institution and joins another. Did he choose this, and thus his fate? In a sense. He willfully chose to leave the first institution because it could not meet his terms.

By Series 5, McNulty is a detective again and, consequently, he goes back to drinking and philandering. However, he was most definitely ripped out of his newly adopted institution by the pull of his old one. Thus, in that sense, he had no choice.

1 “[The show is] really about the American city, and about how we live together. It’s about how institutions have an effect on individuals, and how, whether you’re a cop, a longshoreman, a drug dealer, a politician, a judge [or] lawyer, you are ultimately compromised and must contend with whatever institution you’ve committed to.” Source: David Simon “The Target” commentary track [DVD], 2005.

2 “Much of our modern theater seems rooted in the Shakespearean discovery of the modern mind. We’re stealing instead from an earlier, less-traveled construct - the Greeks - lifting our thematic stance wholesale from Aeschylus, Sophocles, Euripides to create doomed and fated protagonists who confront a rigged game and their own mortality.” Source: David Simon interview in The Believer, 2007.

 

215

If Twitter has invented a new mode of communication, and Digg has invented a new mode of content filtering, does that mean that there is lots of room for Twitter clones that cater to different communities, in the same way that there are lots of Digg clones that lean towards different topics and styles of content?

 

Listen! Listen!

Just found an amazing American public radio interview programme, The Sound Of Young America. The interviewer asks interesting questions and gets out of the way. I have listened, in a prostration of amazement, to the following:

Ariel Schrag
Steve Albini