Notice This is a beta feature offered by Google. Also this is automatic translation, which means the results are often inacurate and/or hilarious. Enjoy.

ARCHIVES / RSS
Blog

Bayesian filtering with the musical set theory in a music suggestion system

h3  ~  22 Dec 2007, 22:19  –  post a comment

Sometimes I have crazy ideas. I also like to explore just how far I can take these crazy ideas. My latest one occurred to me while I was thinking about how fast Hypem is being dullized (yeah I just made up this word..). I also occasionally use Songza but it's search based. I don't have time for this, I just want to listen to music. New music, good music.

Also, I recently re-red "A plan for Spam" by Paul Graham, the first time I didn't knew much about Bayesian Filtering. But know that I've learned a bit more on the subject it was interesting to take a second view on his article.

So.. inevitably I had to ask myself, could I do a site like Hypem or Songza but harness the power of Bayesian filtering to give user what they want ? I knew first hand that it's not a simple task because classifying musical genres programatically is not a trivial task, actually when you think about it it's quite a mind boggling task.

My first apprehension was Bayesian filtering, it's not a trivial task to take advantage of it in a useful manner. I had apprehensions about it because I'm not really good in mathematics and I never studied calculus. But it turns out it's not that complicated, Wikipedia explain the mathematical foundation like this:

"Bayes' theorem, in the context of spam, says that the probability that an email is spam, given that it has certain words in it, is equal to the probability of finding those certain words in spam email, times the probability that any email is spam, divided by the probability of finding those words in any email" – Wikipedia

OK, that's seems fairly understandable so far. But music is no words, well.. yes but not exclusively. And defining genres with names is useless because genres evolves, changes, merges and emerges. Oh, that was poetic.. well maybe not. The bottom line is that you can't really "classify" music as we do it in real life, let alone do it programatically.

What leads me to my second apprehension. I don't know much about music. I'm pretty good at recognizing talent when I hear it, but it's as far as it goes. There isn't a single instrument I can play. I could not even play maracas properly.

However Wikipedia was there to save the day. After some reading I found out mostly what I needed. I knew right away that song titles or band names were irrelevant. Obviously I would need other properties to distinguish songs. Identifying instruments or beats were also irrelevant in my opinion. I was searching for something more .. basic. Something that describe the musical structure of a song, not only the notes themselves. It turns out I was searching for Pitch classes, which are part of the musical set theory.

In music, a pitch class is a set of all pitches that are a whole number of octaves apart, e.g. the pitch class C consists of the Cs in all octaves. Thus, using scientific pitch notation the pitch class "C" is the infinite set

{Cn} = {..., C-2, C-1, C0, C1, C2, C3 ...}

Pitch class is important because human pitch-perception is periodic: pitches belonging to the same pitch class are perceived as having a similar "quality" or "color." Psychologists refer to the quality of a pitch as its "chroma"; music theorists use the term "pitch class" instead.

Let's pretend I understood it all for a second. In theory I could replace emails by pitch classes and words by pitches in the bayesian spam algorithm:

Pr(unlikedPitches|likedPitches)=Pr(likedPitches|unlikedPitches) Pr(unlikedPitches)
                                -------------------------------------------------
                                                Pr(likedPitches)

In other words: the probability that a pitch class is not liked, given that it has certain pitches in it, is equal to the probability of finding those certain pitches in a not liked pitch class, times the probability that any pitch class is not liked, divided by the probability of finding those pitches in any pitch class.

Problems:

  • creating a suitable Bayesian algorithm.
    Mine is cute but also naive and probably stand in the drunk digressions category. Seriously, I don't think it would work has is and I frankly have no idea of how well a system could guess the taste of a person based solely on extracted pitch classes. Probably some other metrics would be required.. But damn it sounds well :D

  • extracting pitch classes
    I made a quick search on the web, there is some amateur efforts being made to achieve it. There is already some claiming to be better than the other at doing it. So I guess it stand in the possible domain. My only fear is that it take a lot of hardware resources to achieve in a large scale system. Well it's probably not insurmountable with a bit of brain juice and 2 tons of Columbian coffee. This makes me think that I don't know if Bayesian filtering is very intensive too.. probably.

  • musical trends and tastes are ephemeral
    My greatest concern though comes from the ephemeral nature of music. New sounds and trends come and go pretty fast, I'm not sure a Bayesian filtering solution would deal well with this. Maybe a constantly learning filter with a limited learning sets would cope, but constant training would be required.. Which I guess would result in less accuracy in good matches and a lot of processing.

Although it's most likely wrong, it's probably as far as I can take this idea right now.

post a comment Comments

no comments :|

Copyrighted stuff .. u know.