simplex.py 文件源码

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

项目:operalib 作者: operalib 项目源码 文件源码
def fit(self, y):
        """Fit simplex coding

        Parameters
        ----------
        targets : array, shape = [n_samples,] or [n_samples, n_classes]
            Target values. The 2-d array represents the simplex coding for
            multilabel classification.

        Returns
        -------
        self : returns an instance of self.
        """
        if self.binarizer is None:
            self.binarizer_ = LabelBinarizer(neg_label=0, pos_label=1,
                                             sparse_output=True)
        self.binarizer_.fit(y)
        dimension = self.binarizer_.classes_.size
        if dimension > 2:
            self.simplex_operator_ = SimplexCoding.code(dimension)
        else:
            self.simplex_operator_ = ones((1, 1))
        return self
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号