2
Cosine similarity Cosine of angle between two vectors The denominator involves the lengths of the documents. n i k i n i j i n i k i j i k j k j k j w w w w d d d d d d sim 1 2 , 1 2 , 1 , , ) , ( Normalization

Cosine similarity

Embed Size (px)

DESCRIPTION

Cosine similarity. Cosine of angle between two vectors The denominator involves the lengths of the documents. Normalization. Example. Docs: Austen's Sense and Sensibility , Pride and Prejudice ; Bronte's Wuthering Heights cos(SAS, PAP) = .996 x .993 + .087 x .120 + .017 x 0.0 = 0.999 - PowerPoint PPT Presentation

Citation preview

Page 1: Cosine similarity

Cosine similarity

Cosine of angle between two vectors The denominator involves the lengths of the

documents.

n

i ki

n

i ji

n

i kiji

kj

kjkj

ww

ww

dd

ddddsim

1

2,1

2,

1 ,,),(

Normalization

Page 2: Cosine similarity

Example

Docs: Austen's Sense and Sensibility, Pride and Prejudice; Bronte's Wuthering Heights

cos(SAS, PAP) = .996 x .993 + .087 x .120 + .017 x 0.0 = 0.999 cos(SAS, WH) = .996 x .847 + .087 x .466 + .017 x .254 = 0.889

SaS PaP WHaffection 115 58 20jealous 10 7 11gossip 2 0 6

SaS PaP WHaffection 0.996 0.993 0.847jealous 0.087 0.120 0.466gossip 0.017 0.000 0.254