sklearn.metrics.pairwise.cosine_similarity(X, Y=None, dense_output=True)
[source]
Compute cosine similarity between samples in X and Y.
Cosine similarity, or the cosine kernel, computes similarity as the normalized dot product of X and Y:
K(X, Y) = <X, Y> / (||X||*||Y||)On L2-normalized data, this function is equivalent to linear_kernel.
Read more in the User Guide.
Parameters: |
|
---|---|
Returns: |
|
© 2007–2018 The scikit-learn developers
Licensed under the 3-clause BSD License.
http://scikit-learn.org/stable/modules/generated/sklearn.metrics.pairwise.cosine_similarity.html