For compiling the LSTM network model, we will use the following code:
# Compile
model %>% compile(optimizer = "rmsprop",
loss = "binary_crossentropy",
metrics = c("acc"))
We are using rmsprop as optimizer and binary_crossentropy for loss, since movie reviews have a binary response or, in other words, they are either positive or negative. For metrics, we are making use of classification accuracy. After compiling the model, we are ready to go to the next step of fitting the LSTM model.