Performance assessment with training data

The code for obtaining the loss, accuracy, and confusion matrix based on the training data is as follows:

# Loss and accuracy
model %>% evaluate(trainx, trainy)
$loss
[1] 3.335224
$acc
[1] 0.8455

# Confusion matrix
pred <- model %>% predict_classes(trainx)
table(Predicted=pred, Actual=data$train$y[1:2000,])
Actual
Predicted 0 1 2 3 4 5 6 7 8 9
0 182 2 8 2 9 4 1 2 10 5
1 1 176 3 5 6 5 2 3 4 7
2 1 0 167 4 3 4 3 2 0 1
3 0 0 0 157 2 1 1 2 1 0
4 2 1 5 6 167 4 2 1 0 0
5 2 0 4 4 3 149 3 4 4 3
6 1 1 3 6 5 2 173 5 0 0
7 3 2 4 2 4 3 9 166 0 1
8 10 1 7 1 6 4 2 2 173 5
9 0 8 2 8 9 7 11 12 11 181

Here, we can see that the loss and accuracy values for the training data are 3.335 and 0.846, respectively. The confusion matrix shows decent results based on the training data. However, for some types of images, misclassifications are high. For example, 12 images from category 7 (horse) are misclassified as category-9 (truck). Similarly, 11 images, each belonging to category-6 (frog) and category-8 (ship), are also misclassified as category-9 (truck).

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset