Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Applied Deep Learning with Keras

You're reading from   Applied Deep Learning with Keras Solve complex real-life problems with the simplicity of Keras

Arrow left icon
Product type Paperback
Published in Apr 2019
Publisher
ISBN-13 9781838555078
Length 412 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Authors (3):
Arrow left icon
Matthew Moocarme Matthew Moocarme
Author Profile Icon Matthew Moocarme
Matthew Moocarme
Mahla Abdolahnejad Mahla Abdolahnejad
Author Profile Icon Mahla Abdolahnejad
Mahla Abdolahnejad
Ritesh Bhagwat Ritesh Bhagwat
Author Profile Icon Ritesh Bhagwat
Ritesh Bhagwat
Arrow right icon
View More author details
Toc

Confusion Matrix


A confusion matrix describes the performance of the classification model. In other words, confusion matrix is a way to summarize classifier performance. The following figure shows a basic representation of a confusion matrix:

Figure 6.5: Basic representation of a confusion matrix

The following code is an example of a confusion matrix:

from sklearn.metrics import confusion_matrix
cm=confusion_matrix(y_test,y_pred_class)
print(cm)

The following figure shows the output of the preceding code:

Figure 6.6: Example confusion matrix

These are the meanings of the abbreviations used in the preceding figure:

  • TN (True negative): This is the count of outcomes that were originally negative and were predicted negative.

  • FP (False positive): This is the count of outcomes that were originally negative but were predicted positive. This error is also called a type 1 error

  • FN (False negative): This is the count of outcomes that were originally positive but were predicted negative. This error is also...

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 $19.99/month. Cancel anytime
Banner background image