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 datatest_Y:array_like, shape (n_samples, n_features), Test labelsreturn 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 the MNIST dataset.