BiclusterMixin#
- class sklearn.base.BiclusterMixin[source]#
- Mixin class for all bicluster estimators in scikit-learn. - This mixin defines the following functionality: - biclusters_property that returns the row and column indicators;
- get_indicesmethod that returns the row and column indices of a bicluster;
- get_shapemethod that returns the shape of a bicluster;
- get_submatrixmethod that returns the submatrix corresponding to a bicluster.
 - Examples - >>> import numpy as np >>> from sklearn.base import BaseEstimator, BiclusterMixin >>> class DummyBiClustering(BiclusterMixin, BaseEstimator): ... def fit(self, X, y=None): ... self.rows_ = np.ones(shape=(1, X.shape[0]), dtype=bool) ... self.columns_ = np.ones(shape=(1, X.shape[1]), dtype=bool) ... return self >>> X = np.array([[1, 1], [2, 1], [1, 0], ... [4, 7], [3, 5], [3, 6]]) >>> bicluster = DummyBiClustering().fit(X) >>> hasattr(bicluster, "biclusters_") True >>> bicluster.get_indices(0) (array([0, 1, 2, 3, 4, 5]), array([0, 1])) - get_indices(i)[source]#
- Row and column indices of the - i’th bicluster.- Only works if - rows_and- columns_attributes exist.- Parameters:
- iint
- The index of the cluster. 
 
- Returns:
- row_indndarray, dtype=np.intp
- Indices of rows in the dataset that belong to the bicluster. 
- col_indndarray, dtype=np.intp
- Indices of columns in the dataset that belong to the bicluster. 
 
 
 - get_shape(i)[source]#
- Shape of the - i’th bicluster.- Parameters:
- iint
- The index of the cluster. 
 
- Returns:
- n_rowsint
- Number of rows in the bicluster. 
- n_colsint
- Number of columns in the bicluster. 
 
 
 - get_submatrix(i, data)[source]#
- Return the submatrix corresponding to bicluster - i.- Parameters:
- iint
- The index of the cluster. 
- dataarray-like of shape (n_samples, n_features)
- The data. 
 
- Returns:
- submatrixndarray of shape (n_rows, n_cols)
- The submatrix corresponding to bicluster - i.
 
 - Notes - Works with sparse matrices. Only works if - rows_and- columns_attributes exist.
 
