From 620a1a4ed1599a07fb5ef26cb41b9256507cda77 Mon Sep 17 00:00:00 2001 From: ciku Date: Sat, 23 Oct 2021 18:29:06 +0300 Subject: [PATCH] Fix doc issues for cluster_optics dbscan --- maint_tools/test_docstrings.py | 1 - sklearn/cluster/_optics.py | 11 +++++------ 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/maint_tools/test_docstrings.py b/maint_tools/test_docstrings.py index a658f13ac8912..b71e72d3bbc65 100644 --- a/maint_tools/test_docstrings.py +++ b/maint_tools/test_docstrings.py @@ -29,7 +29,6 @@ "sklearn.cluster._mean_shift.estimate_bandwidth", "sklearn.cluster._mean_shift.get_bin_seeds", "sklearn.cluster._mean_shift.mean_shift", - "sklearn.cluster._optics.cluster_optics_dbscan", "sklearn.cluster._optics.cluster_optics_xi", "sklearn.cluster._optics.compute_optics_graph", "sklearn.cluster._spectral.spectral_clustering", diff --git a/sklearn/cluster/_optics.py b/sklearn/cluster/_optics.py index 45a080839c6ae..c9725b569576d 100755 --- a/sklearn/cluster/_optics.py +++ b/sklearn/cluster/_optics.py @@ -398,7 +398,7 @@ def _compute_core_distances_(X, neighbors, min_samples, working_memory): def compute_optics_graph( X, *, min_samples, max_eps, metric, p, metric_params, algorithm, leaf_size, n_jobs ): - """Computes the OPTICS reachability graph. + """Compute the OPTICS reachability graph. Read more in the :ref:`User Guide `. @@ -621,7 +621,7 @@ def _set_reach_dist( def cluster_optics_dbscan(*, reachability, core_distances, ordering, eps): - """Performs DBSCAN extraction for an arbitrary epsilon. + """Perform DBSCAN extraction for an arbitrary epsilon. Extracting the clusters runs in linear time. Note that this results in ``labels_`` which are close to a :class:`~sklearn.cluster.DBSCAN` with @@ -630,13 +630,13 @@ def cluster_optics_dbscan(*, reachability, core_distances, ordering, eps): Parameters ---------- reachability : array of shape (n_samples,) - Reachability distances calculated by OPTICS (``reachability_``) + Reachability distances calculated by OPTICS (``reachability_``). core_distances : array of shape (n_samples,) - Distances at which points become core (``core_distances_``) + Distances at which points become core (``core_distances_``). ordering : array of shape (n_samples,) - OPTICS ordered point indices (``ordering_``) + OPTICS ordered point indices (``ordering_``). eps : float DBSCAN ``eps`` parameter. Must be set to < ``max_eps``. Results @@ -647,7 +647,6 @@ def cluster_optics_dbscan(*, reachability, core_distances, ordering, eps): ------- labels_ : array of shape (n_samples,) The estimated labels. - """ n_samples = len(core_distances) labels = np.zeros(n_samples, dtype=int)