Finding the accuracy of the model

Accuracy of the model is found by computing mean accuracy over the test set. It is implemented in the following method:

def score(self, test_X, test_Y):  ...

Here, the parameters are as follows:

  • test_X: array_like, shape (n_samples, n_features), Test data
  • test_Y: array_like, shape (n_samples, n_features), Test labels
  • return float: mean accuracy over the test set
def score(self, test_X, test_Y):    with self.tf_graph.as_default():        with tf.Session() as self.tf_session:            self.tf_saver.restore(self.tf_session, self.model_path)            feed = {                self.input_data: test_X,                self.input_labels: test_Y,                self.keep_prob: 1            }            return self.accuracy.eval(feed)

In the next section, we will look at how DBN implementation can be used on ...

Get Neural Network Programming with TensorFlow now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.