def get_fpr_tpr_roc(model, test_data, test_truth, labels):
y_pred = model.predict(test_data, batch_size=32, verbose=0)
# Compute ROC curve and ROC area for each class
fpr = dict()
tpr = dict()
roc_auc = dict()
for k in labels.keys():
cur_idx = labels[k]
fpr[labels[k]], tpr[labels[k]], _ = roc_curve(test_truth[:,cur_idx], y_pred[:,cur_idx])
roc_auc[labels[k]] = auc(fpr[labels[k]], tpr[labels[k]])
# Compute micro-average ROC curve and ROC area
fpr["micro"], tpr["micro"], _ = roc_curve(test_truth.ravel(), y_pred.ravel())
roc_auc["micro"] = auc(fpr["micro"], tpr["micro"])
return fpr, tpr, roc_auc
chrom_hmm_cnn.py 文件源码
python
阅读 26
收藏 0
点赞 0
评论 0
评论列表
文章目录