SpectralCoclustering
¶
-
class
ibex.sklearn.cluster.
SpectralCoclustering
(n_clusters=3, svd_method='randomized', n_svd_vecs=None, mini_batch=False, init='k-means++', n_init=10, n_jobs=1, random_state=None)¶ Bases:
sklearn.cluster.bicluster.SpectralCoclustering
,ibex._base.FrameMixin
Note
The documentation following is of the class wrapped by this class. There are some changes, in particular:
- A parameter
X
denotes apandas.DataFrame
. - A parameter
y
denotes apandas.Series
.
Spectral Co-Clustering algorithm (Dhillon, 2001).
Clusters rows and columns of an array X to solve the relaxed normalized cut of the bipartite graph created from X as follows: the edge between row vertex i and column vertex j has weight X[i, j].
The resulting bicluster structure is block-diagonal, since each row and each column belongs to exactly one bicluster.
Supports sparse matrices, as long as they are nonnegative.
Read more in the User Guide.
- n_clusters : integer, optional, default: 3
- The number of biclusters to find.
- svd_method : string, optional, default: ‘randomized’
- Selects the algorithm for finding singular vectors. May be
‘randomized’ or ‘arpack’. If ‘randomized’, use
sklearn.utils.extmath.randomized_svd()
, which may be faster for large matrices. If ‘arpack’, usescipy.sparse.linalg.svds()
, which is more accurate, but possibly slower in some cases. - n_svd_vecs : int, optional, default: None
- Number of vectors to use in calculating the SVD. Corresponds to ncv when svd_method=arpack and n_oversamples when svd_method is ‘randomized`.
- mini_batch : bool, optional, default: False
- Whether to use mini-batch k-means, which is faster but may get different results.
- init : {‘k-means++’, ‘random’ or an ndarray}
- Method for initialization of k-means algorithm; defaults to ‘k-means++’.
- n_init : int, optional, default: 10
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.
- n_jobs : int, optional, default: 1
The number of jobs to use for the computation. This works by breaking down the pairwise matrix into n_jobs even slices and computing them in parallel.
If -1 all CPUs are used. If 1 is given, no parallel computing code is used at all, which is useful for debugging. For n_jobs below -1, (n_cpus + 1 + n_jobs) are used. Thus for n_jobs = -2, all CPUs but one are used.
- random_state : int, RandomState instance or None, optional, default: None
- If int, random_state is the seed used by the random number generator; If RandomState instance, random_state is the random number generator; If None, the random number generator is the RandomState instance used by np.random.
- rows_ : array-like, shape (n_row_clusters, n_rows)
- Results of the clustering. rows[i, r] is True if
cluster i contains row r. Available only after calling
fit
. - columns_ : array-like, shape (n_column_clusters, n_columns)
- Results of the clustering, like rows.
- row_labels_ : array-like, shape (n_rows,)
- The bicluster label of each row.
- column_labels_ : array-like, shape (n_cols,)
- The bicluster label of each column.
- Dhillon, Inderjit S, 2001. Co-clustering documents and words using bipartite spectral graph partitioning.
-
fit
(X, y=None)¶ Note
The documentation following is of the class wrapped by this class. There are some changes, in particular:
- A parameter
X
denotes apandas.DataFrame
. - A parameter
y
denotes apandas.Series
.
Creates a biclustering for X.
X : array-like, shape (n_samples, n_features)
y : Ignored
- A parameter
- A parameter