In this section, we will carry out model evaluation and create a confusion matrix with the help of predictions, both for training and test data. Let's start by evaluating the image classification performance of the model using training data.
Model evaluation and prediction
Loss, accuracy, and confusion matrices for training data
We will now obtain loss and accuracy values for the training data and then create a confusion matrix using the following code:
# Model evaluation
model %>% evaluate(trainx, trainLabels)
OUTPUT
12/12 [==============================] - 0s 87us/step
$loss
[1] 0.055556579307
$acc
[1] 1
# Confusion matrix
pred <- model %>% predict_classes(trainx)
table(Predicted=pred, Actual=trainy)
OUTPUT
...