def __call__(self, sess, epoch, iteration, model, loss):
if iteration == 0 and epoch % self.at_every_epoch == 0:
total = 0
correct = 0
truth_all = []
pred_all = []
for values in self.batcher:
total += len(values[-1])
feed_dict = {}
for i in range(0, len(self.placeholders)):
feed_dict[self.placeholders[i]] = values[i]
truth = np.argmax(values[-1], 1) # values[2], batch sampled from data[2], is a 3-legth one-hot vector containing the labels. this is to transform those back into integers
predicted = sess.run(tf.arg_max(tf.nn.softmax(model), 1),
feed_dict=feed_dict)
correct += sum(truth == predicted)
truth_all.extend(truth)
pred_all.extend(predicted)
print(classification_report(truth_all, pred_all, target_names=["NONE", "AGAINST", "FAVOR"], digits=4))
评论列表
文章目录