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

时间:2017-07-14 08:23:07

标签: tensorflow tflearn

我想得到混乱矩阵 但为此,我需要一组谓词项和标签。 如何从tflearn获取此数据,例如本例(Pannous speech_data)https://github.com/llSourcell/tensorflow_speech_recognition_demo/blob/master/demo.py

谢谢!

    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))

1 个答案:

答案 0 :(得分:1)

_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
)