evaluation.py 文件源码

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

项目:single-cell-classification 作者: whuTommy 项目源码 文件源码
def optimize_threshold_with_roc(roc, thresholds, criterion='dist'):
    if roc.shape[1] > roc.shape[0]:
        roc = roc.T
    assert(roc.shape[0] == thresholds.shape[0])
    if criterion == 'margin':
        scores = roc[:,1]-roc[:,0]
    else:
        scores = -cdist(np.array([[0,1]]), roc)
    ti = np.nanargmax(scores)
    return thresholds[ti], ti
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号