Skip to content

Commit a5dfba9

Browse files
DOC docstring styles updates to dbscan (scikit-learn#16819)
Co-authored-by: sophsoph321 <[email protected]>
1 parent c84ad60 commit a5dfba9

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

sklearn/cluster/_dbscan.py

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -29,19 +29,19 @@ def dbscan(X, eps=0.5, min_samples=5, metric='minkowski', metric_params=None,
2929
3030
Parameters
3131
----------
32-
X : array or sparse (CSR) matrix of shape (n_samples, n_features), or \
33-
array of shape (n_samples, n_samples)
32+
X : {array-like, sparse (CSR) matrix} of shape (n_samples, n_features) or \
33+
(n_samples, n_samples)
3434
A feature array, or array of distances between samples if
3535
``metric='precomputed'``.
3636
37-
eps : float, optional
37+
eps : float, default=0.5
3838
The maximum distance between two samples for one to be considered
3939
as in the neighborhood of the other. This is not a maximum bound
4040
on the distances of points within a cluster. This is the most
4141
important DBSCAN parameter to choose appropriately for your data set
4242
and distance function.
4343
44-
min_samples : int, optional
44+
min_samples : int, default=5
4545
The number of samples (or total weight) in a neighborhood for a point
4646
to be considered as a core point. This includes the point itself.
4747
@@ -55,33 +55,33 @@ def dbscan(X, eps=0.5, min_samples=5, metric='minkowski', metric_params=None,
5555
X may be a :term:`sparse graph <sparse graph>`,
5656
in which case only "nonzero" elements may be considered neighbors.
5757
58-
metric_params : dict, optional
58+
metric_params : dict, default=None
5959
Additional keyword arguments for the metric function.
6060
6161
.. versionadded:: 0.19
6262
63-
algorithm : {'auto', 'ball_tree', 'kd_tree', 'brute'}, optional
63+
algorithm : {'auto', 'ball_tree', 'kd_tree', 'brute'}, default='auto'
6464
The algorithm to be used by the NearestNeighbors module
6565
to compute pointwise distances and find nearest neighbors.
6666
See NearestNeighbors module documentation for details.
6767
68-
leaf_size : int, optional (default = 30)
68+
leaf_size : int, default=30
6969
Leaf size passed to BallTree or cKDTree. This can affect the speed
7070
of the construction and query, as well as the memory required
7171
to store the tree. The optimal value depends
7272
on the nature of the problem.
7373
74-
p : float, optional
74+
p : float, default=2
7575
The power of the Minkowski metric to be used to calculate distance
7676
between points.
7777
78-
sample_weight : array, shape (n_samples,), optional
78+
sample_weight : array-like of shape (n_samples,), default=None
7979
Weight of each sample, such that a sample with a weight of at least
8080
``min_samples`` is by itself a core sample; a sample with negative
8181
weight may inhibit its eps-neighbor from being core.
8282
Note that weights are absolute, and default to 1.
8383
84-
n_jobs : int or None, optional (default=None)
84+
n_jobs : int, default=None
8585
The number of parallel jobs to run for neighbors search. ``None`` means
8686
1 unless in a :obj:`joblib.parallel_backend` context. ``-1`` means
8787
using all processors. See :term:`Glossary <n_jobs>` for more details.
@@ -90,10 +90,10 @@ def dbscan(X, eps=0.5, min_samples=5, metric='minkowski', metric_params=None,
9090
9191
Returns
9292
-------
93-
core_samples : array [n_core_samples]
93+
core_samples : ndarray of shape (n_core_samples,)
9494
Indices of core samples.
9595
96-
labels : array [n_samples]
96+
labels : ndarray of shape (n_samples,)
9797
Cluster labels for each point. Noisy samples are given the label -1.
9898
9999
See also
@@ -200,21 +200,21 @@ class DBSCAN(ClusterMixin, BaseEstimator):
200200
The power of the Minkowski metric to be used to calculate distance
201201
between points.
202202
203-
n_jobs : int or None, default=None
203+
n_jobs : int, default=None
204204
The number of parallel jobs to run.
205205
``None`` means 1 unless in a :obj:`joblib.parallel_backend` context.
206206
``-1`` means using all processors. See :term:`Glossary <n_jobs>`
207207
for more details.
208208
209209
Attributes
210210
----------
211-
core_sample_indices_ : array, shape = [n_core_samples]
211+
core_sample_indices_ : ndarray of shape (n_core_samples,)
212212
Indices of core samples.
213213
214-
components_ : array, shape = [n_core_samples, n_features]
214+
components_ : ndarray of shape (n_core_samples, n_features)
215215
Copy of each core sample found by training.
216216
217-
labels_ : array, shape = [n_samples]
217+
labels_ : ndarray of shape (n_samples)
218218
Cluster labels for each point in the dataset given to fit().
219219
Noisy samples are given the label -1.
220220
@@ -288,13 +288,13 @@ def fit(self, X, y=None, sample_weight=None):
288288
289289
Parameters
290290
----------
291-
X : array-like or sparse matrix, shape (n_samples, n_features), or \
291+
X : {array-like, sparse matrix} of shape (n_samples, n_features), or \
292292
(n_samples, n_samples)
293293
Training instances to cluster, or distances between instances if
294294
``metric='precomputed'``. If a sparse matrix is provided, it will
295295
be converted into a sparse ``csr_matrix``.
296296
297-
sample_weight : array, shape (n_samples,), optional
297+
sample_weight : array-like of shape (n_samples,), default=None
298298
Weight of each sample, such that a sample with a weight of at least
299299
``min_samples`` is by itself a core sample; a sample with a
300300
negative weight may inhibit its eps-neighbor from being core.
@@ -367,13 +367,13 @@ def fit_predict(self, X, y=None, sample_weight=None):
367367
368368
Parameters
369369
----------
370-
X : array-like or sparse matrix, shape (n_samples, n_features), or \
370+
X : {array-like, sparse matrix} of shape (n_samples, n_features), or \
371371
(n_samples, n_samples)
372372
Training instances to cluster, or distances between instances if
373373
``metric='precomputed'``. If a sparse matrix is provided, it will
374374
be converted into a sparse ``csr_matrix``.
375375
376-
sample_weight : array, shape (n_samples,), optional
376+
sample_weight : array-like of shape (n_samples,), default=None
377377
Weight of each sample, such that a sample with a weight of at least
378378
``min_samples`` is by itself a core sample; a sample with a
379379
negative weight may inhibit its eps-neighbor from being core.
@@ -384,7 +384,7 @@ def fit_predict(self, X, y=None, sample_weight=None):
384384
385385
Returns
386386
-------
387-
labels : ndarray, shape (n_samples,)
387+
labels : ndarray of shape (n_samples,)
388388
Cluster labels. Noisy samples are given the label -1.
389389
"""
390390
self.fit(X, sample_weight=sample_weight)

0 commit comments

Comments
 (0)