我有一个程序,从中我可以得到以下信息: - 真正例(TP)。 - 假正例(FP)。 - 真负例(TN)。 - 假负例(FN)。
我想用 Tex 编写一个代码,生成混淆矩阵,除了显示准确率、查准率、查全率等其他指标外,还会显示这四个值。
我将非常感谢您的帮助,提前谢谢。
我想要这样的东西:
这是我刚刚尝试过的示例代码(但它给出了错误):
\begin{table}[H]
\begin{tabular}{ccclclc}
\multicolumn{2}{c}{\cellcolor[HTML]{FFFFFF}} & \multicolumn{4}{c}
{Correlation Results} & \cellcolor[HTML]{FFFFFF} \\
\multicolumn{2}{c}{\multirow{-2}{*}{\cellcolor[HTML]{FFFFFF}Total Population}} & \multicolumn{2}{c}{Condition Positive (Malicious)} &
\multicolumn{2}{c}{Condition Negative (Non-Malicious)} & \multirow{-2}{*}{\cellcolor[HTML]{FFFFFF}Accuracy} \\
& Test Outcome Positive (Anomalous) & \multicolumn{2}{c}{True Positive} & \multicolumn{2}{c}{False Positive} & \multicolumn{1}{l}{False Discovery Rate} \\
\multirow{-2}{*}{Anomaly Detection Results} & Test Outcome Negative (Non-Anomalous) & \multicolumn{2}{c}{False Negative} & \multicolumn{2}{c}{True Negative} & \multicolumn{1}{l}{Negative Predictive Value} \\
\multicolumn{2}{c}{\cellcolor[HTML]{FFFFFF}sgdjd} & \multicolumn{2}{c}{Recall} & \multicolumn{2}{c}{False Positive Rate (Fall-out)} &
\cellcolor[HTML]{FFFFFF}F1 Score
\end{tabular}
\end{table}
答案1
我怀疑这是计算机从其他格式(HTML?)翻译过来的,所以它能正常工作,但方式有点绕。此外,它似乎需要彩色背景,就像
\documentclass{standalone}
\usepackage{xcolor}
\usepackage{colortbl}
\usepackage{multirow}
\begin{document}
\colorbox{yellow}{%
\begin{tabular}{ccclclc}
\multicolumn{2}{c}{\cellcolor[HTML]{FFFFFF}} & \multicolumn{4}{c}{Correlation Results} & \cellcolor[HTML]{FFFFFF} \\
\multicolumn{2}{c}{\multirow{-2}{*}{\cellcolor[HTML]{FFFFFF}Total Population}} & \multicolumn{2}{c}{Condition Positive (Malicious)} &
\multicolumn{2}{c}{Condition Negative (Non-Malicious)} & \multirow{-2}{*}{\cellcolor[HTML]{FFFFFF}Accuracy} \\
\multirow{2}{*}{Anomaly Detection Results} & Test Outcome Positive (Anomalous) & \multicolumn{2}{c}{True Positive} & \multicolumn{2}{c}{False Positive} & \multicolumn{1}{l}{False Discovery Rate} \\
& Test Outcome Negative (Non-Anomalous) & \multicolumn{2}{c}{False Negative} & \multicolumn{2}{c}{True Negative} & \multicolumn{1}{l}{Negative Predictive Value} \\
\multicolumn{2}{c}{\cellcolor[HTML]{FFFFFF}sgdjd} & \multicolumn{2}{c}{Recall} & \multicolumn{2}{c}{False Positive Rate (Fall-out)} &
\cellcolor[HTML]{FFFFFF}F1 Score
\end{tabular}}
\end{document}
不用说,这可以简化并使用更直观的调色板。