In this section, we will use test data to evaluate the model performance. We can certainly calculate loss and accuracy values using the training data; however, the real test of a classification model is when it is used with unseen data. And since test data is kept separate from the model building process, we can now use it for model evaluation. We will first calculate loss and accuracy values with the test data and then develop a confusion matrix.
Model evaluation and predictions
Loss and accuracy calculation
The code for obtaining loss and accuracy values using the test data along with the output is shown in the following:
# Model evaluation
model %>%
evaluate(test, testLabels)
OUTPUT
## $loss
## [1] 0.4439415
##
## ...