相关疑难解决方法(0)

如何使用Tensorflow创建预测和地面真实标签的混淆矩阵?

我已经在使用TensorFlow的帮助下实现了Nueral Network模型的分类.但是,我不知道如何通过使用预测分数(准确度)来绘制混淆矩阵.我不是TensorFlow的专家,仍处于学习阶段.在这里,我粘贴了下面的代码,请告诉我如何编写代码以便从以下代码中产生混淆:

# Launch the graph
with tf.Session() as sess:
sess.run(init)

# Set logs writer into folder /tmp/tensorflow_logs
#summary_writer = tf.train.SummaryWriter('/tmp/tensorflow_logs', graph_def=sess.graph_def)

# Training cycle
for epoch in range(training_epochs):
    avg_cost = 0.
    total_batch = int(X_train.shape[0]/batch_size)

    # Loop over total length of batches
    for i in range(total_batch):  
        #picking up random batches from training set of specific size
        batch_xs, batch_ys = w2v_utils.nextBatch(X_train, y_train, batch_size)
        # Fit training using batch data
        sess.run(optimizer, feed_dict={x: batch_xs, y: batch_ys})
        # Compute average loss
        avg_cost += sess.run(cost, …
Run Code Online (Sandbox Code Playgroud)

python confusion-matrix tensorflow

4
推荐指数
1
解决办法
9388
查看次数

标签 统计

confusion-matrix ×1

python ×1

tensorflow ×1