A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://scikit-learn.org/stable/modules/generated/sklearn.metrics.pairwise.cosine_distances.html below:

cosine_distances — scikit-learn 1.7.0 documentation

cosine_distances#
sklearn.metrics.pairwise.cosine_distances(X, Y=None)[source]#

Compute cosine distance between samples in X and Y.

Cosine distance is defined as 1.0 minus the cosine similarity.

Read more in the User Guide.

Parameters:
X{array-like, sparse matrix} of shape (n_samples_X, n_features)

Matrix X.

Y{array-like, sparse matrix} of shape (n_samples_Y, n_features), default=None

Matrix Y.

Returns:
distancesndarray of shape (n_samples_X, n_samples_Y)

Returns the cosine distance between samples in X and Y.

Examples

>>> from sklearn.metrics.pairwise import cosine_distances
>>> X = [[0, 0, 0], [1, 1, 1]]
>>> Y = [[1, 0, 0], [1, 1, 0]]
>>> cosine_distances(X, Y)
array([[1.   , 1.   ],
       [0.422, 0.183]])

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4