With the model building complete, we're ready to compile and train our model. By now, you should be familiar with the model compilation in Keras. As always, there are certain parameters we need to decide when we compile our model. They are as follows:
- Loss function: We use a binary_crossentropy loss function when the target output is binary and a categorical_crossentropy loss function when the target output is multi-class. Since the sentiment of movie reviews in this project is binary (that is, positive or negative), we will use a binary_crossentropy loss function.
- Optimizer: The choice of optimizer is an interesting problem in LSTMs. Without getting into the technicalities, certain optimizers may not work for ...