8000 DOC fixed SpectralCoclustering and SpectralBiclustering docstrings fo… · panpiort8/scikit-learn@f859964 · GitHub < 8000 body class="logged-out env-production page-responsive" style="word-wrap: break-word;">
Skip to content

Commit f859964

Browse files
cgsavardPan Jan
authored andcommitted
DOC fixed SpectralCoclustering and SpectralBiclustering docstrings following sklearn guideline (scikit-learn#15778)
1 parent ac5ba7e commit f859964

File tree

1 file changed

+37
-33
lines changed

1 file changed

+37
-33
lines changed

sklearn/cluster/_bicluster.py

Lines changed: 37 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -191,39 +191,40 @@ class SpectralCoclustering(BaseSpectral):
191191
192192
Parameters
193193
----------
194-
n_clusters : integer, optional, default: 3
194+
n_clusters : int, default=3
195195
The number of biclusters to find.
196196
197-
svd_method : string, optional, default: 'randomized'
197+
svd_method : {'randomized', 'arpack'}, default='randomized'
198198
Selects the algorithm for finding singular vectors. May be
199199
'randomized' or 'arpack'. If 'randomized', use
200200
:func:`sklearn.utils.extmath.randomized_svd`, which may be faster
201201
for large matrices. If 'arpack', use
202202
:func:`scipy.sparse.linalg.svds`, which is more accurate, but
203203
possibly slower in some cases.
204204
205-
n_svd_vecs : int, optional, default: None
205+
n_svd_vecs : int, default=None
206206
Number of vectors to use in calculating the SVD. Corresponds
207207
to `ncv` when `svd_method=arpack` and `n_oversamples` when
208208
`svd_method` is 'randomized`.
209209
210-
mini_batch : bool, optional, default: False
210+
mini_batch : bool, default=False
211211
Whether to use mini-batch k-means, which is faster but may get
212212
different results.
213213
214-
init : {'k-means++', 'random' or an ndarray}
215-
Method for initialization of k-means algorithm; defaults to
216-
'k-means++'.
214+
init : {'k-means++', 'random', or ndarray of shape \
215+
(n_clusters, n_features), default='k-means++'
216+
Method for initialization of k-means algorithm; defaults to
217+
'k-means++'.
217218
218-
n_init : int, optional, default: 10
219+
n_init : int, default=10
219220
Number of random initializations that are tried with the
220221
k-means algorithm.
221222
222223
If mini-batch k-means is used, the best initialization is
223224
chosen and the algorithm runs once. Otherwise, the algorithm
224225
is run for each initialization and the best solution chosen.
225226
226-
n_jobs : int or None, optional (default=None)
227+
n_jobs : int, default=None
227228
The number of jobs to use for the computation. This works by breaking
228229
down the pairwise matrix into n_jobs even slices and computing them in
229230
parallel.
@@ -232,24 +233,24 @@ class SpectralCoclustering(BaseSpectral):
232233
``-1`` means using all processors. See :term:`Glossary <n_jobs>`
233234
for more details.
234235
235-
random_state : int, RandomState instance or None (default)
236+
random_state : int, RandomState instance, default=None
236237
Used for randomizing the singular value decomposition and the k-means
237238
initialization. Use an int to make the randomness deterministic.
238239
See :term:`Glossary <random_state>`.
239240
240241
Attributes
241242
----------
242-
rows_ : array-like, shape (n_row_clusters, n_rows)
243+
rows_ : array-like of shape (n_row_clusters, n_rows)
243244
Results of the clustering. `rows[i, r]` is True if
244245
cluster `i` contains row `r`. Available only after calling ``fit``.
245246
246-
columns_ : array-like, shape (n_column_clusters, n_columns)
247+
columns_ : array-like of shape (n_column_clusters, n_columns)
247248
Results of the clustering, like `rows`.
248249
249-
row_labels_ : array-like, shape (n_rows,)
250+
row_labels_ : array-like of shape (n_rows,)
250251
The bicluster label of each row.
251252
252-
column_labels_ : array-like, shape (n_cols,)
253+
column_labels_ : array-like of shape (n_cols,)
253254
The bicluster label of each column.
254255
255256
Examples
@@ -319,55 +320,58 @@ class SpectralBiclustering(BaseSpectral):
319320
320321
Parameters
321322
----------
322-
n_clusters : integer or tuple (n_row_clusters, n_column_clusters)
323+
n_clusters : int or tuple (n_row_clusters, n_column_clusters), default=3
323324
The number of row and column clusters in the checkerboard
324325
structure.
325326
326-
method : string, optional, default: 'bistochastic'
327+
method : {'bistochastic', 'scale', 'log'}, default='bistochastic'
327328
Method of normalizing and converting singular vectors into
328329
biclusters. May be one of 'scale', 'bistochastic', or 'log'.
329330
The authors recommend using 'log'. If the data is sparse,
330331
however, log normalization will not work, which is why the
331-
default is 'bistochastic'. CAUTION: if `method='log'`, the
332-
data must not be sparse.
332+
default is 'bistochastic'.
333333
334-
n_components : integer, optional, default: 6
334+
.. warning::
335+
if `method='log'`, the data must be sparse.
336+
337+
n_components : int, default=6
335338
Number of singular vectors to check.
336339
337-
n_best : integer, optional, default: 3
340+
n_best : int, default=3
338341
Number of best singular vectors to which to project the data
339342
for clustering.
340343
341-
svd_method : string, optional, default: 'randomized'
344+
svd_method : {'randomized', 'arpack'}, default='randomized'
342345
Selects the algorithm for finding singular vectors. May be
343346
'randomized' or 'arpack'. If 'randomized', uses
344347
:func:`~sklearn.utils.extmath.randomized_svd`, which may be faster
345348
for large matrices. If 'arpack', uses
346349
`scipy.sparse.linalg.svds`, which is more accurate, but
347350
possibly slower in some cases.
348351
349-
n_svd_vecs : int, optional, default: None
352+
n_svd_vecs : int, default=None
350353
Number of vectors to use in calculating the SVD. Corresponds
351354
to `ncv` when `svd_method=arpack` and `n_oversamples` when
352355
`svd_method` is 'randomized`.
353356
354-
mini_batch : bool, optional, default: False
357+
mini_batch : bool, default=False
355358
Whether to use mini-batch k-means, which is faster but may get
356359
different results.
357360
358-
init : {'k-means++', 'random' or an ndarray}
359-
Method for initialization of k-means algorithm; defaults to
360-
'k-means++'.
361+
init : {'k-means++', 'random'} or ndarray of (n_clusters, n_features), \
362+
default='k-means++'
363+
Method for initialization of k-means algorithm; defaults to
364+
'k-means++'.
361365
362-
n_init : int, optional, default: 10
366+
n_init : int, default=10
363367
Number of random initializations that are tried with the
364368
k-means algorithm.
365369
366370
If mini-batch k-means is used, the best initialization is
367371
chosen and the algorithm runs once. Otherwise, the algorithm
368372
is run for each initialization and the best solution chosen.
369373
370-
n_jobs : int or None, optional (default=None)
374+
n_jobs : int, default=None
371375
The number of jobs to use for the computation. This works by breaking
372376
down the pairwise matrix into n_jobs even slices and computing them in
373377
parallel.
@@ -376,24 +380,24 @@ class SpectralBiclustering(BaseSpectral):
376380
``-1`` means using all processors. See :term:`Glossary <n_jobs>`
377381
for more details.
378382
379-
random_state : int, RandomState instance or None (default)
383+
random_state : int, RandomState instance, default=None
380384
Used for randomizing the singular value decomposition and the k-means
381385
initialization. Use an int to make the randomness deterministic.
382386
See :term:`Glossary <random_state>`.
383387
384388
Attributes
385389
----------
386-
rows_ : array-like, shape (n_row_clusters, n_rows)
390+
rows_ : array-like of shape (n_row_clusters, n_rows)
387391
Results of the clustering. `rows[i, r]` is True if
388392
cluster `i` contains row `r`. Available only after calling ``fit``.
389393
390-
columns_ : array-like, shape (n_column_clusters, n_columns)
394+
columns_ : array-like of shape (n_column_clusters, n_columns)
391395
Results of the clustering, like `rows`.
392396
393-
row_labels_ : array-like, shape (n_rows,)
397+
row_labels_ : array-like of shape (n_rows,)
394398
Row partition labels.
395399
396-
column_labels_ : array-like, shape (n_cols,)
400+
column_labels_ : array-like of shape (n_cols,)
397401
Column partition labels.
398402
399403
Examples

0 commit comments

Comments
 (0)
0