The code to obtain the loss and accuracy values from the training data is as follows:
model %>% evaluate(train_x, train_y)$loss 0.3745659$acc 0.83428
As we can see, for training data, the loss and accuracy are 0.375 and 0.834, respectively. To look deeper into the model's sentiment classification performance, we need to develop a confusion matrix. To do so, use the following code:
pred <- model %>% predict_classes(train_x)table(Predicted=pred, Actual=imdb$train$y) ActualPredicted 0 1 0 11128 2771 1 1372 9729
In the preceding code, we are predicting that the classes for the training data are using the model and comparing the results with the actual sentiment classes of the movie reviews. This is summarized ...