BiclusterMixin#
- class sklearn.base.BiclusterMixin[source]#
Mixin 類別,用於 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]))
- 屬性 biclusters_#
取得列和行指標的便捷方法。
回傳
rows_
和columns_
成員。