@@ -227,8 +227,7 @@ def euclidean_distances(
227
227
X , Y = None , * , Y_norm_squared = None , squared = False , X_norm_squared = None
228
228
):
229
229
"""
230
- Considering the rows of X (and Y=X) as vectors, compute the
231
- distance matrix between each pair of vectors.
230
+ Compute the distance matrix between each pair from a vector array X and Y.
232
231
233
232
For efficiency reasons, the euclidean distance between a pair of row
234
233
vector x and y is computed as::
@@ -250,10 +249,12 @@ def euclidean_distances(
250
249
Parameters
251
250
----------
252
251
X : {array-like, sparse matrix} of shape (n_samples_X, n_features)
252
+ An array where each row is a sample and each column is a feature.
253
253
254
254
Y : {array-like, sparse matrix} of shape (n_samples_Y, n_features), \
255
255
default=None
256
- If `None`, uses `Y=X`.
256
+ An array where each row is a sample and each column is a feature.
257
+ If `None`, method uses `Y=X`.
257
258
258
259
Y_norm_squared : array-like of shape (n_samples_Y,) or (n_samples_Y, 1) \
259
260
or (1, n_samples_Y), default=None
@@ -270,19 +271,21 @@ def euclidean_distances(
270
271
``(X**2).sum(axis=1)``)
271
272
May be ignored in some cases, see the note below.
272
273
273
- Notes
274
- -----
275
- To achieve better accuracy, `X_norm_squared` and `Y_norm_squared` may be
276
- unused if they are passed as ``float32``.
277
-
278
274
Returns
279
275
-------
280
276
distances : ndarray of shape (n_samples_X, n_samples_Y)
277
+ Returns the distances between the row vectors of `X`
278
+ and the row vectors of `Y`.
281
279
282
280
See Also
283
281
--------
284
282
paired_distances : Distances betweens pairs of elements of X and Y.
285
283
284
+ Notes
285
+ -----
286
+ To achieve a better accuracy, `X_norm_squared` and `Y_norm_squared` may be
287
+ unused if they are passed as `np.float32`.
288
+
286
289
Examples
287
290
--------
288
291
>>> from sklearn.metrics.pairwise import euclidean_distances
0 commit comments