Cosine Similarity, Euclidean Distance, Naturallanguageprocessing.
(5,3) and (2,4) are two points in a 2D plane. (a . b) = (5*2) + (3*4) = 10 + 12 = 22 |a| = √ (52 + 32) = 5.83 |b| = √ (22 + 42) = 4.47 Using cosine distance formula, d = 1–22 / (5.83 * 4.47) d = 1–0.844 d = 0.156 Note: if θ = 0, distance = 1 — cos θ = 1–1 = 0 Section 3- Cosine distance using Python