在tflearn.regression中使用验证监视器来创建混淆矩阵

时间:2017-03-04 17:12:33

标签: machine-learning tensorflow autoencoder tflearn

所以我一直在尝试在自动编码器中创建混淆度量标准

from __future__ import division, print_function, absolute_import

import numpy as np
#import matplotlib.pyplot as plt
import tflearn
import tensorflow as tf
from random import randint
from tensorflow.contrib import metrics as ms 
# Data loading and preprocessing
import tflearn.datasets.mnist as mnist
Images, Lables, testImages, testLables = mnist.load_data(one_hot=True)


f = randint(0,20)

x = tf.placeholder("float",[None, 784])
y = tf.placeholder("float",[None, 10])
# Building the encoder
encoder = tflearn.input_data(shape=[None, 784])
encoder = tflearn.fully_connected(encoder, 256)
encoder = tflearn.fully_connected(encoder, 64)
encoder = tflearn.fully_connected(encoder, 10)

acc= tflearn.metrics.Accuracy()

# Regression, with mean square error
net = tflearn.regression(encoder, optimizer='adam', learning_rate=0.001,
                         loss='mean_square', metric=acc, shuffle_batches=True, validation_monitors = ?)


model = tflearn.DNN(net, tensorboard_verbose=0)

model.fit(Images, Lables, n_epoch=20, validation_set=(testImages, testLables),
          run_id="auto_encoder", batch_size=256,show_metric=True)

#Applying the above model on test Images and evaluating as well as prediction of the labels

evali= model.evaluate(testImages,testLables)
print("Accuracy of the model is :", evali)
lables = model.predict_label(testImages)
print("The predicted labels are :",lables[f])
prediction = model.predict(testImages)
print("The predicted probabilities are :", prediction[f])

我已经完成了文件记录,但它们对我来说并不是很有用。

如何配置以获取混淆矩阵?

validation_monitors ={?}

0 个答案:

没有答案
相关问题