SpectralBiclustering
- class sklearn.cluster.SpectralBiclustering(n_clusters=3, *, method='bistochastic', n_components=6, n_best=3, svd_method='randomized', n_svd_vecs, , , ,
Spectral biclustering (Kluger, 2003) [1].
Partitions rows and columns under the assumption that the data has an underlying checkerboard structure. For instance, if there are two row partitions and three column partitions, each row will belong to three biclusters, and each column will belong to two biclusters. The outer product of the corresponding row and column label vectors gives this checkerboard structure.
Read more in the User Guide.
The number of row and column clusters in the checkerboard structure.
Method of normalizing and converting singular vectors into biclusters. May be one of ‘scale’, ‘bistochastic’, or ‘log’. The authors recommend using ‘log’. If the data is sparse, however, log normalization will not work, which is why the default is ‘bistochastic’.
Number of singular vectors to check.
Number of best singular vectors to which to project the data for clustering.
Selects the algorithm for finding singular vectors. May be
‘randomized’ or ‘arpack’. If ‘randomized’, uses
randomized_svd, which may be faster
for large matrices. If ‘arpack’, uses
scipy.sparse.linalg.svds, which is more accurate, but
possibly slower in some cases.
Number of vectors to use in calculating the SVD. Corresponds
to ncv when svd_method=arpack and n_oversamples when
svd_method is ‘randomized`.
Whether to use mini-batch k-means, which is faster but may get different results.
Method for initialization of k-means algorithm; defaults to ‘k-means++’.
Number of random initializations that are tried with the k-means algorithm.
If mini-batch k-means is used, the best initialization is chosen and the algorithm runs once. Otherwise, the algorithm is run for each initialization and the best solution chosen.
Used for randomizing the singular value decomposition and the k-means initialization. Use an int to make the randomness deterministic. See Glossary.
Results of the clustering. rows[i, r] is True if
cluster i contains row r. Available only after calling fit.
Results of the clustering, like rows.
Row partition labels.
>>> from sklearn.cluster import SpectralBiclustering
>>> import numpy as np
>>> X = np.array([[1, 1], [2, 1], [1, 0],
... [
For a more detailed example, see A demo of the Spectral Biclustering algorithm
Create a biclustering for X.
Training data.
Not used, present for API consistency by convention.
Row and column indices of the i’th bicluster.
Only works if rows_ and columns_ attributes exist.
The index of the cluster.
Get metadata routing of this object.
Please check User Guide on how the routing mechanism works.
A MetadataRequest encapsulating
routing information.
Get parameters for this estimator.
If True, will return the parameters for this estimator and contained subobjects that are estimators.
Parameter names mapped to their values.
Shape of the i’th bicluster.
The index of the cluster.
Number of rows in the bicluster.
Number of columns in the bicluster.
Return the submatrix corresponding to bicluster i.
The index of the cluster.
The data.
Set the parameters of this estimator.
The method works on simple estimators as well as on nested objects
(such as Pipeline). The latter have
parameters of the form <component>__<parameter> so that it’s
possible to update each component of a nested object.
Estimator parameters.
Column partition labels.
biclusters_ : tuple of two ndarraysConvenient way to get row and column indicators together.
Number of features seen during fit.
n_features_in_,)Names of features seen during fit. Defined only when X
has feature names that are all strings.
SpectralBiclustering instance.
Indices of rows in the dataset that belong to the bicluster.
Indices of columns in the dataset that belong to the bicluster.
The submatrix corresponding to bicluster i.
Works with sparse matrices. Only works if rows_ and
columns_ attributes exist.
Estimator instance.