CSCE 470 Lecture 6

From Notes
Jump to navigation Jump to search

« previous | Friday, September 6, 2013 | next »


Search Ranking

Two Key Questions

  1. How to represent each query or document?
    • set of terms
    • bag of words → TF, log TF, TF IDF
  2. How to measure similarity (or distance) between q and d?
    • Jaccard
    • Manhattan Distance (|u1v1|++|unvn|
    • Euclidean Distance ((u1v1)2++(unvn)2)
    • Cosine

Cosine Similarity

Measures angle between query vector q and document vector d. Two vectors are similar if

  • the angle between is smaller (i.e. θ0), and thus
  • the cosine similarity is larger (i.e. cosθ1)

From vector calculus, we can find the cosine between two vectors as follows:

sim(q,d)=cosθ=qdqd

If the vectors are stored in a normalized format, the similarity formula becomes much easier:

q^=qqd^=ddsim(q^,d^)=cosθ=q^d^