Current Slide

Small screen detected. You are viewing the mobile version of SlideWiki. If you wish to edit slides you will need to use a larger device.

Example: Cosine Similarity

  • cos(d1, d2) = (d1d2) / ||d1|| ||d2|| ,
    where ⋅ indicates vector dot product, ||d|: the length of vector d
  • Ex: Find the similarity between documents 1 and 2.
    d1 = (5, 0, 3, 0, 2, 0, 0, 2, 0, 0)
    d2 = (3, 0, 2, 0, 1, 1, 0, 1, 0, 1)
    d1 d2 = 5*3+0*0+3*2+0*0+2*1+0*1+0*1+2*1+0*0+0*1 = 25
    ||d1|| = (5*5+0*0+3*3+0*0+2*2+0*0+0*0+2*2+0*0+0*0)0.5 = (42) 0.5 = 6.481
    ||d2|| = (3*3+0*0+2*2+0*0+1*1+1*1+0*0+1*1+0*0+1*1)0.5 = (17) 0.5 = 4.12
    cos(d1, d2 ) = 0.94

Speaker notes:

Content Tools

Sources

There are currently no sources for this slide.