bibit.py 文件源码

python
阅读 35 收藏 0 点赞 0 评论 0

项目:biclustlib 作者: padilha 项目源码 文件源码
def run(self, data):
        """Compute biclustering.

        Parameters
        ----------
        data : numpy.ndarray
        """
        data = check_array(data, dtype=np.bool, copy=True)
        self._validate_parameters()

        data = [np.packbits(row) for row in data]
        biclusters = []
        patterns_found = set()

        for ri, rj in combinations(data, 2):
            pattern = np.bitwise_and(ri, rj)
            pattern_cols = sum(popcount(int(n)) for n in pattern)

            if pattern_cols >= self.min_cols and self._is_new(patterns_found, pattern):
                rows = [k for k, r in enumerate(data) if self._match(pattern, r)]

                if len(rows) >= self.min_rows:
                    cols = np.where(np.unpackbits(pattern) == 1)[0]
                    biclusters.append(Bicluster(rows, cols))

        return Biclustering(biclusters)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号