def train_test(self): epochs, best_epoch = self.train_neural_network() self.saver.restore(sess=self.session, save_path=self.save_path) test_correct, test_cls_pred, test_cost = self.predict_cls( mu=self.test_x_mu, logvar=self.test_x_logvar, labels=self.test_y, cls_true=(convert_labels_to_cls(self.test_y))) feed_dict = { self.x_lab_mu: self.test_x_mu, self.x_lab_logvar: self.test_x_logvar, self.y_lab: self.test_y } logits = self.session.run(self.y_lab_logits, feed_dict=feed_dict) plot_roc(logits, self.test_y, self.num_classes, name='Conv VAE Class') print_test_accuracy(test_correct, test_cls_pred, self.test_y, logging) plot_cost(training=self.train_cost, validation=self.validation_cost, name="Cost", epochs=epochs, best_epoch=best_epoch) plot_line(self.validation_accuracy, name='Validation Accuracy', epochs=epochs, best_epoch=best_epoch)
def train_test(self): self.train_neural_network() self.saver.restore(sess=self.session, save_path=self.save_path) correct, cls_pred = self.predict_cls(images=self.test_x, labels=self.test_y, cls_true=(convert_labels_to_cls(self.test_y))) feed_dict = {self.x: self.test_x, self.y: self.test_y} logits = self.session.run(self.y_logits, feed_dict=feed_dict) plot_roc(logits, self.test_y, self.num_classes, name='MLP') print_test_accuracy(correct, cls_pred, self.test_y, logging)
def train_test(self): self.train_neural_network() self.saver.restore(sess=self.session, save_path=self.save_path) correct, cls_pred, test_marg_lik = self.predict_cls( images=self.test_x, labels=self.test_y, cls_true=(convert_labels_to_cls(self.test_y))) feed_dict = { self.x_lab: self.test_x, self.y_lab: self.test_y, self.is_training: False } marg_print = "test marginal_likelihood:{}".format(test_marg_lik) print(marg_print) logging.debug(marg_print) print_test_accuracy(correct, cls_pred, self.test_y, logging) logits = self.session.run(self.y_lab_logits, feed_dict=feed_dict) plot_roc(logits, self.test_y, self.num_classes, name='auxiliary') self.test_reconstruction()