@@ -218,7 +218,7 @@ def radius_neighbors_graph(
218
218
219
219
220
220
class KNeighborsTransformer (KNeighborsMixin , TransformerMixin , NeighborsBase ):
221
- """Transform X into a (weighted) graph of k nearest neighbors
221
+ """Transform X into a (weighted) graph of k nearest neighbors.
222
222
223
223
The transformed data is a sparse graph as returned by kneighbors_graph.
224
224
@@ -258,7 +258,7 @@ class KNeighborsTransformer(KNeighborsMixin, TransformerMixin, NeighborsBase):
258
258
nature of the problem.
259
259
260
260
metric : str or callable, default='minkowski'
261
- metric to use for distance computation. Any metric from scikit-learn
261
+ Metric to use for distance computation. Any metric from scikit-learn
262
262
or scipy.spatial.distance can be used.
263
263
264
264
If metric is a callable function, it is called on each
@@ -317,6 +317,13 @@ class KNeighborsTransformer(KNeighborsMixin, TransformerMixin, NeighborsBase):
317
317
n_samples_fit_ : int
318
318
Number of samples in the fitted data.
319
319
320
+ See Also
321
+ --------
322
+ kneighbors_graph : Compute the weighted graph of k-neighbors for
323
+ points in X.
324
+ RadiusNeighborsTransformer : Transform X into a weighted graph of
325
+ neighbors nearer than a radius.
326
+
320
327
Examples
321
328
--------
322
329
>>> from sklearn.manifold import Isomap
@@ -359,6 +366,8 @@ def fit(self, X, y=None):
359
366
X : {array-like, sparse matrix} of shape (n_samples, n_features) or \
360
367
(n_samples, n_samples) if metric='precomputed'
361
368
Training data.
369
+ y : Ignored
370
+ Not used, present for API consistency by convention.
362
371
363
372
Returns
364
373
-------
@@ -368,7 +377,7 @@ def fit(self, X, y=None):
368
377
return self ._fit (X )
369
378
370
379
def transform (self , X ):
371
- """Computes the (weighted) graph of Neighbors for points in X
380
+ """Compute the (weighted) graph of Neighbors for points in X.
372
381
373
382
Parameters
374
383
----------
@@ -400,7 +409,8 @@ def fit_transform(self, X, y=None):
400
409
X : array-like of shape (n_samples, n_features)
401
410
Training set.
402
411
403
- y : ignored
412
+ y : Ignored
413
+ Not used, present for API consistency by convention.
404
414
405
415
Returns
406
416
-------
0 commit comments