Followup question from: LSTM with keras
In this example a one hot encoded vector is used to perform classification using an LSTM. How could this LSTM be used to perform k-hot encodings where the k
value is not a constant value. Say for instance k
could be 3
or k
could be 5
or k
could be some other varying integer in some samples?
This is a multiclass classification task. In order to solve that you need to:
Set your output activation to sigmoid:
Set your targets to indicator encoding:
If you e.g. 4 classes and for a given example set classes 0 and 2 your output should be
[1, 0, 1, 0]
Use the following loss: