Skip to main content

Cosine Similarity 餘弦相似性

AB=A×Bcos(θ)AB=i=1nAi×BiA=i=1nAi2\begin{aligned} A \cdot B & = ||A|| \times ||B|| cos(\theta) \\ A \cdot B & = \sum_{i=1}^{n} A_i \times B_i \\ ||A|| & = \sqrt{\sum_{i=1}^{n} A_i^2} \\ \end{aligned} CosineSimilarity(A,B)=cos(θ)=ABA×BCosineSimilarity(A, B) = cos(\theta) = \frac{A \cdot B}{||A|| \times ||B||}