简体   繁体   English

深度学习的困惑矩阵

[英]Confusion Matrix for Deep Learning

I have been trying to print out the confusion matrix for my model but failed to do so. 我一直在尝试为我的模型打印混淆矩阵,但是没有这样做。

However, I successfully obtained a (7x7) confusion matrix but in tensor format. 但是,我成功地获得了张量格式的(7x7)混淆矩阵。

I am new to Tensorflow so please help me with displaying the tensor. 我是Tensorflow的新手,所以请帮助我显示张量。 Thank you. 谢谢。

code: 码:

con_mat = tf.confusion_matrix(labels=[0, 1, 2, 3, 4, 5, 6], predictions=correct, num_classes=n_classes,
                              dtype=tf.int32, name=None)
with tf.Session():
    print('Confusion Matrix: \n\n', tf.Tensor.eval(con_mat, feed_dict=None, session=None))

output: 输出:

tensorflow.python.framework.errors_impl.InvalidArgumentError: Shape [-1,100,88] has negative dimensions
 [[Node: Placeholder = Placeholder[dtype=DT_FLOAT, shape=[?,100,88], _device="/job:localhost/replica:0/task:0/cpu:0"]()]]

It seems you are not feeding the input placeholder value to calculate the tensor correct. 看来您没有输入输入的占位符值来计算tensor正确。

feeddict = {your_placeholder: value}
with tf.Session() as sess:
    print('Confusion Matrix: \n\n', tf.Tensor.eval(con_mat, feed_dict=feeddict, session=sess))

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM