How To Classify Both Sentiment And Genres From Movie Reviews Using Cnn Tensorflow
Solution 1:
Basically at the final layer of the CNN as you've resized the CNN output to a form of 1x1xN, add two Feed-Forward Neural Networks. So if you have a simple classification problem you feed the output of the CNN into a Feed-Forward Neural Network, now in this case you'll have two of these networks. So in order to accomplish this basically you'll have the following:
- CNN output ---feed---> Classifier#1
- CNN output ---feed---> Classifier#2
Thus you'll have to separate classifications BUT you'll still have to backpropagate them so it will look something like this:
loss1 = tf.reduce_mean(tf.nn.softmax_cross_entropy_with_logits(prediction1, labels_1))
loss2 = tf.reduce_mean(tf.nn.softmax_cross_entropy_with_logits(prediction2, labels_2))
loss = loss1 + loss2
So you'll "minimize" the loss
with an optimizer.
Solution 2:
You can treat this as a multi-label
problem, and append the sentiment
and the tone
labels together.
Now since the network has to predict multiple outputs (2 in this case) you need to use an activation function like sigmoid
and not softmax
. And your prediction can be made using tf.round(logits)
.
Post a Comment for "How To Classify Both Sentiment And Genres From Movie Reviews Using Cnn Tensorflow"