metrics.py 文件源码

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

项目:aes 作者: feidong1991 项目源码 文件源码
def spearman(y_true, y_pred):
    """
    Calculate Spearman's rank correlation coefficient between ``y_true`` and
    ``y_pred``.

    :param y_true: The true/actual/gold labels for the data.
    :type y_true: array-like of float
    :param y_pred: The predicted/observed labels for the data.
    :type y_pred: array-like of float

    :returns: Spearman's rank correlation coefficient if well-defined, else 0
    """
    ret_score = spearmanr(y_true, y_pred)[0]
    return ret_score if not np.isnan(ret_score) else 0.0
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号