Deep Learning with Keras Tutorial
Selected Reading
- Deep Learning with Keras - Discussion
- Deep Learning with Keras - Useful Resources
- Deep Learning with Keras - Quick Guide
- Conclusion
- Loading Model for Predictions
- Saving Model
- Predicting on Test Data
- Evaluating Model Performance
- Training the Model
- Preparing Data
- Compiling the Model
- Creating Deep Learning Model
- Importing Libraries
- Setting up Project
- Deep Learning
- Deep Learning with Keras - Introduction
- Deep Learning with Keras - Home
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
Predicting on Test Data
Predicting on Test Data
To predict the digits in an unseen data is very easy. You simply need to call the predict_classes method of the model by passing it to a vector consisting of your unknown data points.
predictions = model.predict_classes(X_test)
The method call returns the predictions in a vector that can be tested for 0’s and 1’s against the actual values. This is done using the following two statements −
correct_predictions = np.nonzero(predictions == y_test)[0] incorrect_predictions = np.nonzero(predictions != y_test)[0]
Finally, we will print the count of correct and incorrect predictions using the following two program statements −
print(len(correct_predictions)," classified correctly") print(len(incorrect_predictions)," classified incorrectly")
When you run the code, you will get the following output −
9837 classified correctly 163 classified incorrectly
Now, as you have satisfactorily trained the model, we will save it for future use.
Advertisements