From f9d046766f590af3c181cb2d994ab1ea125d1216 Mon Sep 17 00:00:00 2001 From: QuadV Date: Sat, 12 Feb 2022 22:00:40 +0100 Subject: [PATCH] DOC Ensures that radius_neighbors_graph passes numpydoc (#22462) --- sklearn/neighbors/_graph.py | 12 ++++++------ sklearn/tests/test_docstrings.py | 1 - 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/sklearn/neighbors/_graph.py b/sklearn/neighbors/_graph.py index 98d7933ea43b1..2be70c0638517 100644 --- a/sklearn/neighbors/_graph.py +++ b/sklearn/neighbors/_graph.py @@ -138,7 +138,7 @@ def radius_neighbors_graph( include_self=False, n_jobs=None, ): - """Computes the (weighted) graph of Neighbors for points in X + """Compute the (weighted) graph of Neighbors for points in X. Neighborhoods are restricted the points at a distance lower than radius. @@ -174,7 +174,7 @@ def radius_neighbors_graph( (l2) for p = 2. For arbitrary p, minkowski_distance (l_p) is used. metric_params : dict, default=None - additional keyword arguments for the metric function. + Additional keyword arguments for the metric function. include_self : bool or 'auto', default=False Whether or not to mark each sample as the first nearest neighbor to @@ -193,6 +193,10 @@ def radius_neighbors_graph( Graph where A[i, j] is assigned the weight of edge that connects i to j. The matrix is of CSR format. + See Also + -------- + kneighbors_graph: Compute the weighted graph of k-neighbors for points in X. + Examples -------- >>> X = [[0], [3], [1]] @@ -203,10 +207,6 @@ def radius_neighbors_graph( array([[1., 0., 1.], [0., 1., 0.], [1., 0., 1.]]) - - See Also - -------- - kneighbors_graph """ if not isinstance(X, RadiusNeighborsMixin): X = NearestNeighbors( diff --git a/sklearn/tests/test_docstrings.py b/sklearn/tests/test_docstrings.py index b11a44c1c61be..d17897ced9a81 100644 --- a/sklearn/tests/test_docstrings.py +++ b/sklearn/tests/test_docstrings.py @@ -120,7 +120,6 @@ "sklearn.model_selection._validation.learning_curve", "sklearn.model_selection._validation.permutation_test_score", "sklearn.model_selection._validation.validation_curve", - "sklearn.neighbors._graph.radius_neighbors_graph", "sklearn.pipeline.make_union", "sklearn.preprocessing._data.binarize", "sklearn.preprocessing._data.maxabs_scale",