【发布时间】:2019-02-12 19:20:34
【问题描述】:
在我的二元分类问题中尝试使用混淆矩阵时遇到此错误。 Y 和 Yhat 都是 numpy 数组。我已尝试将 .argmax 作为建议的解决方案 - 我不再收到错误,但输出不是我知道的混淆矩阵。
Accuracy: 0.9982449999999999
Accuracy: 0.9983374013937532
shape of y = (1, 200000)
shape of yhat = (1, 200000)
错误
ValueError Traceback (most recent call last) <ipython-input-13-ebb660b4585a> in <module>()
12 print("shape of yhat = ", yhat.shape)
13
---> 14 cm = confusion_matrix(y,yhat)
15
16 print("confusion matrix = ", cm)
/anaconda3/lib/python3.6/site-packages/sklearn/metrics/classification.py in confusion_matrix(y_true, y_pred, labels, sample_weight)
250 y_type, y_true, y_pred = _check_targets(y_true, y_pred)
251 if y_type not in ("binary", "multiclass"):
--> 252 raise ValueError("%s is not supported" % y_type)
253
254 if labels is None:
ValueError: multilabel-indicator is not supported
【问题讨论】:
-
嗨!欢迎来到 StackOverflow!我认为如果你有正确的格式,你可以大大改善你的帖子。此外,您应该考虑提供Minimal Complete Verifiable Example (MCVE)
-
嗨,谢谢。你可以说我是堆栈溢出以及 NN 和 Python 的新手。该代码非常简单,并在错误消息中进行了概述:cm = chaos_matrix(y,yhat)。我在两个熟化的阵列上对其进行了测试,并且有效。但是,不能解决我真正的问题。
-
@SubhashDesai 欢迎使用 Stackoverflow,以后你也应该包含代码
标签: python neural-network