Machne Percepton of Musc & Audo Topc 9: Measurng Dstance Bran Pardo EECS 352 Wnter 2010 1
Wh measure dstance? Clusterng requres dstance measures. Local methods requre a measure of localt Search engnes requre a measure of smlart Bran Pardo EECS 352 Wnter 2010
Dmenson 2 Eucldean Dstance What people ntutvel thnk of as dstance d 2 2 1 1 2 2 Dmenson 1 Bran Pardo EECS 352 Wnter 2010
Generalzed Eucldean Dstance n = the number of dmensons d where n 1 1 1 2 2...... 2 n n 1/ 2 } and Bran Pardo EECS 352 Wnter 2010
L p norms L p norms are all specal cases of ths: d n 1 p 1/ p p changes the norm 1 L 1 norm Manhattan Dstance: p 1 2 L 2 norm Eucldean Dstance: p 2 Hammng Dstance: p 1and 01 Bran Pardo EECS 352 Wnter 2010
Weghtng Dmensons Put pont n the cluster wth the closest center of gravt Whch cluster should the red pont go n? How do I measure dstance n a wa that gves the rght answer for both stuatons? Bran Pardo EECS 352 Wnter 2010
Weghted Norms You can compensate b weghtng our dmensons. d n 1/ w p 1 p Ths lets ou turn our crcle of equal-dstance nto an elpse wth aes parallel to the dmensons of the vectors. Bran Pardo EECS 352 Wnter 2010
What s a metrc? A metrc has these four qualtes. otherwse call t a measure nequalt trangle smmetr non - negatve 0 reflev t ff 0 z d z d d d d d d Bran Pardo EECS 352 Wnter 2010
Metrc or not? Drvng dstance wth 1-wa streets Categorcal Stuff : Is dstance Jazz to Blues to Rock no less than dstance Jazz to Rock? Bran Pardo EECS 352 Wnter 2010
Categorcal Varables Consder feature vectors for genre & vocals: Genre: {Blues Jazz Rock Zdeco} Vocals: {vocalsno vocals} s1 = {rock vocals} s2 = {azz no vocals} s3 = { rock no vocals} Whch two songs are more smlar? Bran Pardo EECS 352 Wnter 2010
One Soluton:Hammng dstance Blues Jazz Rock Zdeco 0 0 1 0 1 0 1 0 0 0 0 0 1 0 0 Vocals s1 = {rock vocals} s2 = {azz no_vocals} s3 = { rock no_vocals} Hammng Dstance = number of bts dfferent between bnar vectors Bran Pardo EECS 352 Wnter 2010
Hammng Dstance Bran Pardo EECS 352 Wnter 2010 {01} and }...... where 2 1 2 1 1 n n n d
Defnng our own dstance an eample How often does artst quote artst? Quote Frequenc Beethoven Beatles Lz Phar Beethoven 7 0 0 Beatles 4 5 0 Lz Phar? 1 2 Let s buld a dstance measure! Bran Pardo EECS 352 Wnter 2010
Defnng our own dstance an eample Beethoven Beatles Lz Phar Beethoven 7 0 0 Beatles 4 5 0 Lz Phar? 1 2 Quotefrequenc Q Dstance d 1 f value n table Q f Q zartsts f z Bran Pardo EECS 352 Wnter 2010
Mssng data What f for some categor on some eamples there s no value gven? Approaches: Dscard all eamples mssng the categor Fll n the blanks wth the mean value Onl use a categor n the dstance measure f both eamples gve a value Bran Pardo EECS 352 Wnter 2010
Dealng wth mssng data n n w n n d w 1 1 else 1 are defned and both f 0 Bran Pardo EECS 352 Wnter 2010
Edt Dstance Quer = strng from fnte alphabet Target = strng from fnte alphabet Cost of Edts = Dstance Target: C A G E D - - Quer: C E A E D
Tpcal Melodc Search Sstem Quer Database Themes Targets Sgt. Pepper s Smlart Ranker Yesterda Ranked Lst
Wh Monophonc Themes? Audo Document Theme 1 Theme 3 Theme 2 PROBLEM Smlart rankers tpcall requre monophonc nput
Smlart Rankng b Edt Dstance Quer = strng Target = strng Cost of Edts = Dstance Target: C A G E D - - Quer: C E A E D
Local Strng Algnment 0 ma 1 1 1 1 q s M s M q M M M -1-1 M -1 M -1 M Insert Delete Match Restart
Local Strng Algnment S Q ma M SIMILARITY THEME QUERY G A B B 0-1 -2-3 -4 G -1 2 1 0-1 D -2 1 0-1 -2 A -3 0 3 2-1 C -4-1 2 1 0 B -5-2 1 4 3
Md Ptch Melod Transcrpton Sung quer 58 56 10 5 54 52 50 Segmented quer 48 46 44 1 2 3 4 5 6 7 8 9 Short Gltch Notes Seconds Ptch Quantzaton Errors musc.
Melod Encodng Transcrpton 10 5 58 56 54 52 50 48 46 44 1 2 3 4 5 6 7 8 9 Encodng up 2 half-steps { +20.5 0 1 01...} 2 nd s ½ length of 1 st note Ptch nterval and rhthm rato Tempo and transposton nvarant Smplfes error modelng musc.cs.northwestern.edu
Response Ptch Interval Modelng Snger Varaton 12 9 6 3 0-3 -6-9 se I nterval Respon Ascendng Maor 6 th 50 stmulus-response pars -12 1 2 9 6 3 0-3 -6-9 -12 Stmulus Ptch Interval In ½ steps 12 to an octave Stmulus 1 Response 1 Stmulus 2 Response 2
Ma sngle-part smlart S Q ma P Q Song Smlart = MAXPart Smlart QUERY PS SCORE
Oops! QUERY Cheap Knock-off To God on Hgh Glor Be
Oops! QUERY Cheap Knock-off To God on Hgh Glor Be
Oops! QUERY Cheap Knock-off To God on Hgh Glor Be
Homophonc Smlart SCORE QUERY M -1-1 M -1 M -1 M
Homophonc Algnment 0 ma 1 1 1 1 q s M s M q M M Insert Delete Match Restart ma n C n C H REPLACES
Skppng Between Parts Quer Score To God On Hgh All Glor Be
Polphonc Algnment Part k+1 L -1-1k+1 Part k L -1-1k L L -1lk+1-1k Part k-1 L -1-1k-1 L -1k L k L -1k-1
Polphonc Algnment 0 ma 1 1 1 1 1 1 1 k l k l p q L k l k l p L p q L p L q L L k l k l k k k k k k Insert Delete Match Restart Shft Shft CHANGE-PART COST
Makng monophonc parts Part 1 notebt Part 2 note
Makng monophonc parts Part 1a Part 1b Part 2a Part 2b Part 2c
TARGET DATABASE Eperment 300 Bach 4-part vocal chorale harmonzatons QUERIES 5 to 25 notes n length Skp between parts wth a probablt of:.25.5.75 1 150 Queres per condton COMPARE Mamal sngle-part smlart Polphonc smlart
Mean rank of correct target Results 25 20 Mamum sngle-part smlart Polphonc algnment 18.9 23.7 15 10 8.7 4.5 5 1.7 2.5 1.6 1.4 1.3 1.3 0 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 Per-note probablt of changng parts n quer
Number of queres Number of queres Ppart change = 0.5 100 Polphonc algnment 50 0 0 10 20 30 40 50 60 70 80 90 100 100 Mamum sngle-part smlart 50 0 0 10 20 30 40 50 60 70 80 90 100 Rank of correct target rght rank
Conclusons Standard sequence algnment fals when queres skp from part to part We etend strng-matchng to handle ths case Ths mproves search performance