grasp.py 文件源码

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

项目:EEG-Grasp-Kaggle 作者: esube 项目源码 文件源码
def score(net, samples=4096):
    """Compute the area under the curve, ROC score from a trained net

    We take `samples` random samples and compute the ROC AUC
    score on those samples. 
    """
    source = net.batch_iterator_test.source
    test_indices = make_valid_indices(source, samples)
    predicted = net.predict_proba(test_indices)
    if predicted.shape[-1] != N_EVENTS:
        predicted = decode(predicted)
    actual = source.events[test_indices]
    try:
        return roc_auc_score(actual.reshape(-1), predicted.reshape(-1))
    except:
        return 0
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号