What loss function in keras should I chose for binary_crossentropy or categorical_crossentropy?

I have data like : $w1,w2,w3,w2,w2,w1,w3,w5,w9,w5,w4...$

I want to predict sequence:

input: $w1,w2,w3$ -> $LSTM$ -> get output: $w2,w2,w1$

I encoded the symbols $w1,w2...$ by obe-hot-encoding

So the input of the model is : $[[1,0,0],[0,1,0],[0,0,1]]$

The output of the model is : $[[0,1,0],[0,1,0],[1,0,0]]$

  • $\begingroup$ You are using multiple outputs/classes which needs categorical_crossentropy. Also, elaborate your question with some information in order to receive proper guidance. $\endgroup$ May 29, 2019 at 11:44
  • $\begingroup$ You can't predict a sequence with ML. You can predict a time series, but a time series requires at least a good handful of features per point in the series. (P.S. the mathematical meaning of sequence vs. series is analogous - although not exactly the same - the difference between your data and a series that ML could be capable of predicting) $\endgroup$
    – grochmal
    May 30, 2019 at 23:30


Your Answer

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

Browse other questions tagged or ask your own question.