Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Machine Learning for Healthcare Analytics Projects

You're reading from  Machine Learning for Healthcare Analytics Projects

Product type Book
Published in Oct 2018
Publisher Packt
ISBN-13 9781789536591
Pages 134 pages
Edition 1st Edition
Languages

Testing the network

What we need to see is whether or not this model can now generalize new information, which is why we reserved the testing dataset earlier. We need to generate a classification report using predictions from the model. To do this, we're going to import the classification_report and the accuracy_score features from the sklearn.metrics library. We also have to predict the values, which is very easy to do using the model.predict() function. We have to print those out and see what we have. The following lines of code show the process of testing the predictions:

# generate classification report using predictions for categorical model
from sklearn.metrics import classification_report, accuracy_score
predictions = model.predict_classes(X_test)
predictions

The preceding code snippet generates an array consisting of 1s and 0s, as shown in the following screenshot:

...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}