1
$\begingroup$

i have read a few blogs and papers on the IMDB exercise w.r.t sentiment classification using LSTM's (and at times in conjunction with CNN) but there the output layer can contain just 1 neuron with a sigmoid since the sentiment can either be good or bad. But if i need to use the same technique to classify, say, 30,000 sentences into 20 different labels then what should my output layer look like ? if i am not mistaken i should have the same number of neurons in my output layer as the number of labels i am training the data for (20 in this case) each of which has the same sigmoid. Can you please let me know if this makes sense ?

$\endgroup$
2
$\begingroup$

When doing a multiclass classification problem, in which the goal is predict exactly one class label for each input, it is standard to use the softmax function (a normalized exponential) as the activation function for the last layer. However, if your problem is a multilabel classification (in which the classes are not mutually exclusive), then using a sigmoid as the activation function would be appropriate. In both situations, you would have as many output units as labels (20 in your case).

$\endgroup$
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.