深度学习的困惑矩阵

时间:2017-08-08 08:51:36

标签: python tensorflow model confusion-matrix

我一直试图为我的模型打印出混淆矩阵,但未能这样做。

然而,我成功地获得了(7x7)混淆矩阵,但是采用张量格式。

我是Tensorflow的新手,所以请帮我显示张量。谢谢。

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

输出:

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"]()]]

1 个答案:

答案 0 :(得分:0)

您似乎没有提供输入占位符值来计算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))
相关问题