<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-866452859765263027</id><updated>2011-08-02T12:04:56.118-07:00</updated><category term='visualization'/><category term='hacking'/><category term='research'/><category term='logic'/><category term='mixtape'/><title type='text'>Arizona Bayes</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://arizonabayes.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/866452859765263027/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://arizonabayes.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Brian McFee</name><uri>http://www.blogger.com/profile/02807470540740721645</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://1.bp.blogspot.com/_eqohhipaq1k/S2BsA643efI/AAAAAAAABlw/hm3tFQzvPSU/S220/blurry.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>3</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-866452859765263027.post-3456031695537463774</id><published>2009-11-22T12:10:00.000-08:00</published><updated>2009-11-23T21:23:44.561-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='mixtape'/><category scheme='http://www.blogger.com/atom/ns#' term='hacking'/><title type='text'>The Traveling Salesmix</title><content type='html'>&lt;span style="font-weight: bold;"&gt;THE WIND-UP&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Imagine that you're throwing a &lt;a href="http://nips.cc/"&gt;party&lt;/a&gt;, and your friends have elected you Music Czar.  Your task is to provide continuous background music throughout the night.  Each guest has provided you with a list of songs they would like to hear, but the order of the tracks is random, and styles vary wildly from one guest to another.&lt;br /&gt;&lt;br /&gt;What's more, your guests are &lt;a href="http://en.wikipedia.org/wiki/David_Hasselhoff"&gt;remorseless party machines&lt;/a&gt; who will undoubtedly stay up well into the next morning, so your mix will have to be several hours long.  If the ordering of songs is too jumpy, the guests may revolt and trash your place.  Since you would like to see your security deposit again, &lt;a href="http://apps.facebook.com/quiztape"&gt;the mix&lt;/a&gt; &lt;a href="http://icanhascheezburger.com/2007/01/28/spice-must-flow/"&gt;must flow&lt;/a&gt;.  What do you do?&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;THE PITCH&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;This can be modeled as a &lt;a href="http://en.wikipedia.org/wiki/Traveling_salesman_problem"&gt;Traveling Salesman Problem&lt;/a&gt;:&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Define a complete graph G where each node is a song in your collection&lt;/li&gt;&lt;li&gt;Edge weights correspond to some notion of distance between songs&lt;/li&gt;&lt;li&gt;Find a simple path touching all nodes in G with minimal total weight&lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;THE DETAILS&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;ol&gt;&lt;li&gt;The first step is to analyze the content of each song.  &lt;a href="http://echonest.com/"&gt;The Echo Nest&lt;/a&gt; makes this incredibly easy with &lt;a href="http://code.google.com/p/pyechonest/"&gt;pyEchoNest&lt;/a&gt;.  From this, we can model the timbral features of each song by a multivariate Gaussian.  &lt;a href="http://numpy.scipy.org/"&gt;NumPy&lt;/a&gt; to the rescue!&lt;/li&gt;&lt;li&gt;Now we have a bunch of statistical models, but we need some notion of distance between these models.  The notion I'll use here is the Euclidean metric applied to a &lt;a href="http://jmlr.csail.mit.edu/papers/volume5/jebara04a/jebara04a.pdf"&gt;Probability Product Kernel&lt;/a&gt;.  Some people might prefer &lt;a href="http://en.wikipedia.org/wiki/KL_divergence"&gt;KL divergence&lt;/a&gt;, but PPK induces a metric, which will allow for more accurate TSP approximations.&lt;/li&gt;&lt;li&gt;Given the kernel matrix K, we can compute its corresponding distance matrix, which then forms the weights of the graph.&lt;/li&gt;&lt;li&gt;Run your &lt;a href="http://en.wikipedia.org/wiki/Christofides_algorithm"&gt;favorite TSP approximator&lt;/a&gt; on the graph, and you're set!&lt;/li&gt;&lt;/ol&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;THE RESULTS&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Exhibit A, an alphabetized playlist:&lt;span style="font-size: 78%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;ol style="font-family: courier new;"&gt;&lt;li&gt;&lt;span style="font-size: 78%;"&gt;Avalanches_-_Since_I_Left_You/(13) Frontier Psychiatrist&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: 78%;"&gt;Banyan_-_Anytime_At_All/(11) Sputnik&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: 78%;"&gt;Cake_-_Prolonging_the_Magic/(07) Sheep Go to Heaven&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: 78%;"&gt;Curtis_Mayfield_-_Superfly/(03) Freddie's Dead&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: 78%;"&gt;Elvis_Costello_-_Best_Of/(07) Elvis Costello &amp;amp; The Attractions - Pump It Up&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: 78%;"&gt;Madame_Blavatsky_Overdrive_-_Idiot_Jones_Will_Have_His_Day/07 MBO&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: 78%;"&gt;MC_Chris_-_Life's_A_Bitch_and_I'm_Her_Pimp/(07) Fett's Vette&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: 78%;"&gt;Parliament_-_Mothership_Connection/(03) Unfunky UFO&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: 78%;"&gt;Propellerheads_-_Decksanddrumsandrockandroll/(10) Propellerheads &amp;amp; David Arnold - On Her Majesty's Secret Service&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: 78%;"&gt;Red_Elvises_-_Surfing_in_Siberia/(05) Hungarian Dance #5&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: 78%;"&gt;Soundtrack_-_Lock_Stock_and_Two_Smoking_Barrels/(16) James Brown - The Payback&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: 78%;"&gt;Soundtrack_-_The_Big_Lebowski/(03) Elvis Costello - My Mood Swings&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: 78%;"&gt;Squirrel_Nut_Zippers_-_Hot/(07) Hell&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: 78%;"&gt;The_J.B.'s_-_Funky_Good_Time:_The_Anthology_[1]/(12) Watermelon Man&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: 78%;"&gt;Thievery_Corporation_-_The_Mirror_Conspiracy/(04) Lebanese Blonde&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;Exhibit B, the ordered mix:&lt;span style="font-size: 78%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;ol&gt;&lt;li style="font-family: courier new;"&gt;&lt;span style="font-family: courier new; font-size: 78%;"&gt;Avalanches_-_Since_I_Left_You/(13) Frontier Psychiatrist&lt;/span&gt;&lt;/li&gt;&lt;li style="font-family: courier new;"&gt;&lt;span style="font-family: courier new; font-size: 78%;"&gt;Banyan_-_Anytime_At_All/(11) Sputnik&lt;/span&gt;&lt;/li&gt;&lt;li style="font-family: courier new;"&gt;&lt;span style="font-family: courier new; font-size: 78%;"&gt;Propellerheads_-_Decksanddrumsandrockandroll/(10) Propellerheads &amp;amp; David Arnold - On Her Majesty's Secret Service&lt;/span&gt;&lt;/li&gt;&lt;li style="font-family: courier new;"&gt;&lt;span style="font-family: courier new; font-size: 78%;"&gt;Elvis_Costello_-_Best_Of/(07) Elvis Costello &amp;amp; The Attractions - Pump It Up&lt;/span&gt;&lt;/li&gt;&lt;li style="font-family: courier new;"&gt;&lt;span style="font-family: courier new; font-size: 78%;"&gt;Cake_-_Prolonging_the_Magic/(07) Sheep Go to Heaven&lt;/span&gt;&lt;/li&gt;&lt;li style="font-family: courier new;"&gt;&lt;span style="font-family: courier new; font-size: 78%;"&gt;Parliament_-_Mothership_Connection/(03) Unfunky UFO&lt;/span&gt;&lt;/li&gt;&lt;li style="font-family: courier new;"&gt;&lt;span style="font-family: courier new; font-size: 78%;"&gt;The_J.B.'s_-_Funky_Good_Time:_The_Anthology_[1]/(12) Watermelon Man&lt;/span&gt;&lt;/li&gt;&lt;li style="font-family: courier new;"&gt;&lt;span style="font-family: courier new; font-size: 78%;"&gt;Thievery_Corporation_-_The_Mirror_Conspiracy/(04) Lebanese Blonde&lt;/span&gt;&lt;/li&gt;&lt;li style="font-family: courier new;"&gt;&lt;span style="font-family: courier new; font-size: 78%;"&gt;Curtis_Mayfield_-_Superfly/(03) Freddie's Dead&lt;/span&gt;&lt;/li&gt;&lt;li style="font-family: courier new;"&gt;&lt;span style="font-family: courier new; font-size: 78%;"&gt;Red_Elvises_-_Surfing_in_Siberia/(05) Hungarian Dance #5&lt;/span&gt;&lt;/li&gt;&lt;li style="font-family: courier new;"&gt;&lt;span style="font-family: courier new; font-size: 78%;"&gt;Soundtrack_-_The_Big_Lebowski/(03) Elvis Costello - My Mood Swings&lt;/span&gt;&lt;/li&gt;&lt;li style="font-family: courier new;"&gt;&lt;span style="font-family: courier new; font-size: 78%;"&gt;Madame_Blavatsky_Overdrive_-_Idiot_Jones_Will_Have_His_Day/07 MBO&lt;/span&gt;&lt;/li&gt;&lt;li style="font-family: courier new;"&gt;&lt;span style="font-family: courier new; font-size: 78%;"&gt;MC_Chris_-_Life's_A_Bitch_and_I'm_Her_Pimp/(07) Fett's Vette&lt;/span&gt;&lt;/li&gt;&lt;li style="font-family: courier new;"&gt;&lt;span style="font-family: courier new; font-size: 78%;"&gt;Soundtrack_-_Lock_Stock_and_Two_Smoking_Barrels/(16) James Brown - The Payback&lt;/span&gt;&lt;/li&gt;&lt;li style="font-family: courier new;"&gt;&lt;span style="font-family: courier new; font-size: 78%;"&gt;Squirrel_Nut_Zippers_-_Hot/(07) Hell&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;THE CODE&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Try it out.  You can download python code for this &lt;a href="http://www.cse.ucsd.edu/%7Ebmcfee/code/tsmix.py"&gt;here&lt;/a&gt;.  You will need the following:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;An Echo Nest &lt;a href="http://developer.echonest.com/"&gt;API key&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://code.google.com/p/pyechonest/"&gt;pyEchoNEst&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://numpy.scipy.org/"&gt;NumPy&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://code.google.com/p/python-graph/"&gt;python-graph&lt;/a&gt;&lt;/li&gt;&lt;li&gt;Some mp3s...&lt;/li&gt;&lt;/ul&gt;Note: for simplicity, the code above implements the 2-approximate metric TSP, not the 1.5-approximate Christofides' algorithm.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/866452859765263027-3456031695537463774?l=arizonabayes.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://arizonabayes.blogspot.com/feeds/3456031695537463774/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=866452859765263027&amp;postID=3456031695537463774' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/866452859765263027/posts/default/3456031695537463774'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/866452859765263027/posts/default/3456031695537463774'/><link rel='alternate' type='text/html' href='http://arizonabayes.blogspot.com/2009/11/travelling-salesmix.html' title='The Traveling Salesmix'/><author><name>Brian McFee</name><uri>http://www.blogger.com/profile/02807470540740721645</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://1.bp.blogspot.com/_eqohhipaq1k/S2BsA643efI/AAAAAAAABlw/hm3tFQzvPSU/S220/blurry.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-866452859765263027.post-4615900556513233984</id><published>2008-12-11T17:51:00.000-08:00</published><updated>2008-12-12T18:47:15.123-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='logic'/><title type='text'>Deep thoughts</title><content type='html'>For all for alls, there exist there exists, but not without not.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/866452859765263027-4615900556513233984?l=arizonabayes.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://arizonabayes.blogspot.com/feeds/4615900556513233984/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=866452859765263027&amp;postID=4615900556513233984' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/866452859765263027/posts/default/4615900556513233984'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/866452859765263027/posts/default/4615900556513233984'/><link rel='alternate' type='text/html' href='http://arizonabayes.blogspot.com/2008/12/deep-thoughts.html' title='Deep thoughts'/><author><name>Brian McFee</name><uri>http://www.blogger.com/profile/02807470540740721645</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://1.bp.blogspot.com/_eqohhipaq1k/S2BsA643efI/AAAAAAAABlw/hm3tFQzvPSU/S220/blurry.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-866452859765263027.post-756026506653590736</id><published>2008-11-28T18:48:00.001-08:00</published><updated>2009-11-23T21:24:13.683-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='visualization'/><category scheme='http://www.blogger.com/atom/ns#' term='research'/><category scheme='http://www.blogger.com/atom/ns#' term='hacking'/><title type='text'>Processing</title><content type='html'>Thanks to popular demand, I'm starting a new blog.  It will overflow with technical nuggets of joy.  Oh yes.&lt;br /&gt;&lt;br /&gt;To celebrate the &lt;a href="http://blog.makezine.com/archive/2008/11/processing_10_officially.html?CMP=OTC-0D6B48984890"&gt;release&lt;/a&gt; of &lt;a href="http://processing.org/"&gt;Processing&lt;/a&gt; 1.0, I decided to give it a spin.  Matlab's visualization tools, while functional, sorely lack in the aesthetics department.  The applet below is the result of a lazy Thanksgiving afternoon of hacking to display the results of some ontological embedding code I've been working on.&lt;br /&gt;&lt;br /&gt;&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;iframe height="300" scrolling="no" src="http://morrison.ucsd.edu/blog/processing1128/embed.html" style="border: medium none; margin: 0pt; padding: 0pt;" width="460"&gt;&lt;/iframe&gt;&lt;br /&gt;&lt;br /&gt;(Controls: &amp;lt;, &amp;gt; to scale images, 'r' to reset, 't' to toggle text, and shift-click to drag.)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/866452859765263027-756026506653590736?l=arizonabayes.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://arizonabayes.blogspot.com/feeds/756026506653590736/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=866452859765263027&amp;postID=756026506653590736' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/866452859765263027/posts/default/756026506653590736'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/866452859765263027/posts/default/756026506653590736'/><link rel='alternate' type='text/html' href='http://arizonabayes.blogspot.com/2008/11/thanks-to-popular-demand-im-starting.html' title='Processing'/><author><name>Brian McFee</name><uri>http://www.blogger.com/profile/02807470540740721645</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://1.bp.blogspot.com/_eqohhipaq1k/S2BsA643efI/AAAAAAAABlw/hm3tFQzvPSU/S220/blurry.jpg'/></author><thr:total>1</thr:total></entry></feed>
