CLFL_mdf_classification.py 文件源码

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

项目:MHG-scansion 作者: henchc 项目源码 文件源码
def _check_binary_probabilistic_predictions(y_true, y_prob):
    """Check that y_true is binary and y_prob contains valid probabilities"""
    check_consistent_length(y_true, y_prob)

    labels = np.unique(y_true)

    if len(labels) != 2:
        raise ValueError("Only binary classification is supported. "
                         "Provided labels %s." % labels)

    if y_prob.max() > 1:
        raise ValueError("y_prob contains values greater than 1.")

    if y_prob.min() < 0:
        raise ValueError("y_prob contains values less than 0.")

    return label_binarize(y_true, labels)[:, 0]
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号