Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/326.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python Roc_曲线位置标签混淆_Python_Scikit Learn_Keras_Deep Learning_Roc - Fatal编程技术网

Python Roc_曲线位置标签混淆

Python Roc_曲线位置标签混淆,python,scikit-learn,keras,deep-learning,roc,Python,Scikit Learn,Keras,Deep Learning,Roc,我有一个关于scikit learn中的roc_曲线的问题,对于深度学习练习,我注意到我的数据有1作为阳性标签。经过我的训练后,测试的准确率在74%左右,但roc曲线下面积(AUC)得分只有0.24 y_pred = model.predict([x_test_real[:, 0],x_test_real[:, 1]]) fpr, tpr, thresholds = metrics.roc_curve(y_test_real, y_pred,pos_label=1) roc_auc = metr

我有一个关于
scikit learn
中的
roc_曲线的问题,对于深度学习练习,我注意到我的数据有1作为阳性标签。经过我的训练后,测试的准确率在74%左右,但roc曲线下面积(AUC)得分只有0.24

y_pred = model.predict([x_test_real[:, 0],x_test_real[:, 1]])
fpr, tpr, thresholds = metrics.roc_curve(y_test_real, y_pred,pos_label=1)
roc_auc = metrics.auc(fpr, tpr)
print("roc_auc:  %0.2f" % roc_auc)
如果我将
pos\u标签
更改为0。auc得分变为0.76(显然)

现在我做了一个小实验,我改变了我的训练和测试标签(这是二进制分类)

这样,应该将正负标签从1翻转到0。然后我再次运行代码。这一次,我们期待着中华民国auc的行为也会发生变化。但是没有

fpr, tpr, thresholds = metrics.roc_curve(y_test_real, y_pred,pos_label=0)
仍在给出0.80,并且带有
pos\u label=1
正在给出0.2。这让我很困惑

  • 如果我改变训练目标中的阳性标签,是否会影响roc_曲线auc值
  • 哪种情况是正确的分析
  • 输出是否与所使用的损失函数有关?我正在使用“对比损失”解决匹配和不匹配的二元分类问题
有人能帮我吗?:)

y_train_real = 1 - y_train_real
y_test_real = 1 - y_test_real
fpr, tpr, thresholds = metrics.roc_curve(y_test_real, y_pred,pos_label=0)