擅长:python、mysql、java
<p>这种混乱可能是因为<code>sklearn</code>遵循了与维基百科文章不同的混乱轴矩阵约定。<strong>所以,回答你的问题:<strong>它以特定的格式给你输出,因为<code>sklearn</code>希望你以特定的方式阅读它。你知道吗</p>
<p>以下是编写混淆矩阵的两种不同方法:</p>
<ul>
<li><a href="https://scikit-learn.org/stable/auto_examples/model_selection/plot_confusion_matrix.html#sphx-glr-auto-examples-model-selection-plot-confusion-matrix-py" rel="nofollow noreferrer">sklearn's way of reading/writing confusion matrix</a>:行中的真标签和列中的预测标签
<a href="https://i.stack.imgur.com/23A36.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/23A36.png" alt="enter image description here"/></a></li>
<li><a href="https://en.wikipedia.org/wiki/Confusion_matrix#Example" rel="nofollow noreferrer">wikipedia example</a>与<code>sklearn</code>相反
<a href="https://i.stack.imgur.com/kJYfP.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/kJYfP.png" alt="enter image description here"/></a></li>
</ul>