[英]Confusion Matrix for Deep Learning
我一直在嘗試為我的模型打印混淆矩陣,但是沒有這樣做。
但是,我成功地獲得了張量格式的(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"]()]]
看來您沒有輸入輸入的占位符值來計算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.