🧩 混淆矩阵与 ROC / PR 曲线(Precision、Recall、F1、AUC)Confusion Matrix & ROC / PR Curve Calculator (Precision, Recall, F1, AUC)
输入混淆矩阵、真实与预测标签,或真实标签与预测分数,计算各类别的 Precision、Recall、F1 和支持数,宏平均、加权平均、准确率、平衡准确率、Cohen κ 和 MCC;二分类还给出灵敏度、特异度、PPV、NPV,并绘制 ROC 和 PR 曲线、计算 AUC 与 AP,拖动阈值查看混淆矩阵变化,一键求 Youden 最佳阈值;结果与 scikit-learn 一致。Enter a confusion matrix, true and predicted labels, or true labels with scores to get per-class precision, recall, F1 and support, macro and weighted averages, accuracy, balanced accuracy, Cohen’s κ and MCC. For binary tasks you also get sensitivity, specificity, PPV and NPV, ROC and PR curves with AUC and AP, a threshold slider and the Youden-optimal threshold. Matches scikit-learn.
| 类别Class | Precision | Recall | F1 | Support |
|---|
所有指标与 scikit-learn 的 classification_report、accuracy_score、balanced_accuracy_score、cohen_kappa_score、matthews_corrcoef、roc_auc_score、average_precision_score 结果一致(已用随机数据含并列分数逐项核对)。AUC 用梯形法(并列分数按对角线连接),AP 用阶梯求和(不插值)。数据只在本机计算。All metrics match scikit-learn (classification_report, accuracy, balanced accuracy, Cohen’s kappa, MCC, roc_auc_score, average_precision_score), cross-checked on random data with tied scores. AUC uses the trapezoid rule (ties joined diagonally); AP is the non-interpolated step sum. Computed locally.
使用说明与常见问题How-to & FAQ
「混淆矩阵与 ROC / PR 曲线(Precision、Recall、F1、AUC)」是什么?What is the Confusion Matrix & ROC / PR Curve Calculator (Precision, Recall, F1, AUC)?
输入混淆矩阵、真实与预测标签,或真实标签与预测分数,计算各类别的 Precision、Recall、F1 和支持数,宏平均、加权平均、准确率、平衡准确率、Cohen κ 和 MCC;二分类还给出灵敏度、特异度、PPV、NPV,并绘制 ROC 和 PR 曲线、计算 AUC 与 AP,拖动阈值查看混淆矩阵变化,一键求 Youden 最佳阈值;结果与 scikit-learn 一致。Enter a confusion matrix, true and predicted labels, or true labels with scores to get per-class precision, recall, F1 and support, macro and weighted averages, accuracy, balanced accuracy, Cohen’s κ and MCC. For binary tasks you also get sensitivity, specificity, PPV and NPV, ROC and PR curves with AUC and AP, a threshold slider and the Youden-optimal threshold. Matches scikit-learn.
如何使用「混淆矩阵与 ROC / PR 曲线(Precision、Recall、F1、AUC)」?How do I use the Confusion Matrix & ROC / PR Curve Calculator (Precision, Recall, F1, AUC)?
选择输入方式:直接输入混淆矩阵(可带类别名,从 Excel 粘贴);或两列“真实标签, 预测标签”;或两列“真实标签 0/1, 预测分数”。分数模式下拖动阈值滑块,混淆矩阵和指标会实时变化,点“最佳阈值”自动选 Youden J 最大的点。“复制报告”给出与 sklearn classification_report 相同格式的文本。Choose the input: a confusion matrix (class names optional, paste from Excel), two columns “true, predicted”, or two columns “true 0/1, score”. In score mode drag the threshold to update the matrix and metrics, or press Best threshold for the Youden-J optimum. Copy report gives text in sklearn classification_report format.
宏平均和加权平均有什么区别?Macro vs weighted average?
宏平均(macro)对每个类别的指标直接求平均,各类别权重相同,更能反映小类别的表现;加权平均(weighted)按每类样本数加权,接近整体表现。类别不平衡时建议同时报告宏平均 F1。Macro averages per-class metrics with equal weight, so small classes count as much as large ones; weighted averages by class size and tracks overall performance. With imbalanced classes, report macro F1 as well.
类别不平衡时看 ROC 还是 PR 曲线?ROC or PR curve for imbalanced data?
正样本很少时,ROC AUC 可能显得很高,而 PR 曲线和平均精度(AP)更能反映模型找出正样本的能力,建议两者都报告。When positives are rare, ROC AUC can look high while the PR curve and average precision better show how well positives are found — report both.
「混淆矩阵与 ROC / PR 曲线(Precision、Recall、F1、AUC)」免费吗?文件会上传吗?Is the Confusion Matrix & ROC / PR Curve Calculator (Precision, Recall, F1, AUC) free? Are my files uploaded?
「混淆矩阵与 ROC / PR 曲线(Precision、Recall、F1、AUC)」完全免费,无需注册。你输入的内容只在本机浏览器里处理(并保存在本机方便下次继续),不会上传到任何服务器,适合处理未发表的论文和数据。The Confusion Matrix & ROC / PR Curve Calculator (Precision, Recall, F1, AUC) is free with no sign-up. Everything you enter is processed in this browser only (and kept locally so you can continue later); nothing is uploaded, so it is safe for unpublished papers and data.