A diagram of the CNN-MLP model.
Audiences' reactions to the movie they have watched can be presented in a text format called reviews. These reviews can be polarized into two clusters: positive responses and negative responses. Using CNN and MLP, one can perform sentiment analysis on movie reviews to automatically recognize the viewer's tendency toward a particular movie. CNN is used for extracting the latent information within the text format. MLP leverages the extracted information of CNN and carries out the classification task. The CNN-MLP model is evaluated with Standford's IMBD Movie Review dataset. On the test set, the model achieves 85.6%
accuracy.
To run the experiment, click here.
The model's performance is measured by the accuracy and loss value. These values are computed regarding the sentiment analysis of the model on the dataset. The loss value is calculated based on the loss function employed in the training process which is the cross-entropy loss.
Dataset Split | Accuracy | Loss |
---|---|---|
Train | 94.1% | 0.347 |
Validation | 96.5% | 0.331 |
Test | 85.6% | 0.454 |
Accuracy curve on the train set and the validation set.
Loss curve on the train set and the validation set.
To understand what CNN sees in deciding whether it is a positive or negative opinion, the GradCAM and TAHV visualization techniques are employed.
Visualization of the first layer of CNN on the positive review.
Visualization of the second layer of CNN on the positive review.
Visualization of the third layer of CNN on the positive review.
Visualization of the first layer of CNN on the negative review.
Visualization of the second layer of CNN on the negative review.
Visualization of the third layer of CNN on the negative review.