Fundamental 基礎Cosine Similarity 餘弦相似性Cosine Similarity 餘弦相似性 A⋅B=∣∣A∣∣×∣∣B∣∣cos(θ)A⋅B=∑i=1nAi×Bi∣∣A∣∣=∑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}A⋅BA⋅B∣∣A∣∣=∣∣A∣∣×∣∣B∣∣cos(θ)=i=1∑nAi×Bi=i=1∑nAi2 CosineSimilarity(A,B)=cos(θ)=A⋅B∣∣A∣∣×∣∣B∣∣CosineSimilarity(A, B) = cos(\theta) = \frac{A \cdot B}{||A|| \times ||B||}CosineSimilarity(A,B)=cos(θ)=∣∣A∣∣×∣∣B∣∣A⋅B