BiclusterMixin#
- class sklearn.base.BiclusterMixin[源代码]#
scikit-learn中所有双聚类估计器的混合类。
此mixin定义了以下功能:
biclusters_
返回行和列指示符的属性;get_indices
返回双集群的行和列索引的方法;get_shape
返回双集群形状的方法;get_submatrix
返回与双集群对应的子矩阵的方法。
示例
>>> 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]))