Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ssis/2.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
Tensorflow 使用Tflearn时如何获取混淆矩阵_Tensorflow_Tflearn - Fatal编程技术网

Tensorflow 使用Tflearn时如何获取混淆矩阵

Tensorflow 使用Tflearn时如何获取混淆矩阵,tensorflow,tflearn,Tensorflow,Tflearn,我想要一个混乱矩阵 但为此,我需要一组谓词项和标签。 如何从tflearn获取此数据,例如,此示例Pannous speech_数据 谢谢 model.fit(trainX, trainY, n_epoch=10, validation_set=(testX, testY), show_metric=True,batch_size=batch_size) _y=model.predict(X) predictions.append(_y) labels.append(trainY) bp

我想要一个混乱矩阵 但为此,我需要一组谓词项和标签。 如何从tflearn获取此数据,例如,此示例Pannous speech_数据

谢谢

    model.fit(trainX, trainY, n_epoch=10, validation_set=(testX, testY), show_metric=True,batch_size=batch_size)
_y=model.predict(X)
predictions.append(_y)
labels.append(trainY)
bp()
confusionMat=tf.confusion_matrix(labels,predictions,num_classes=classes,dtype=tf.int32,name=None,weights=None)
print(np.matrix(confusionMat))

谢谢你的及时答复。简单且有意义:。因此,实际上需要在每次迭代时将_y和train y添加到预测和标签中,然后在最后计算混淆矩阵?尝试过了,但标签和预测应该是类数组。然而,使用tflearn,每个项目都是一个具有该类概率的数组。我应该如何使用它作为标签/预处理?请尝试调试并理解代码。您的混淆矩阵需要两个数组。一个标签是预测类,另一个标签是预测类。所以,返回概率分数时,尝试返回预测类。预测类是概率分数分类的地方。!!
_y=model.predict(X)  # predictions
y = train_Y # i think this is actual labels data

tf.confusion_matrix(
labels,               # put y here
predictions,          #put _y here
num_classes=None,
dtype=tf.int32,
name=None,
weights=None
)