Should we have only binary labels for LSTM?


Is it possible to have non-binary labels for LSTM? I mean an array like

[ 100 120 140 20 50 70]

Instead of

[1 0 1 0 0 1 1]

for example! Isn't this opposite of LSTM's essence and doesn't reduce it's performance?


Posted 2019-02-15T10:52:32.103

Reputation: 163



Welcome to the site. Generally speaking, you can have any labels you need/want and I don't think that the "essence" of LSTM will be affected. Recall that LSTM is special because it has the ability to "forget" and throw away data (mostly data that leads to factor fading). So, your choice of labels will not prevent you from leveraging the wonderful benefits of LSTM.

However, it's possible that you are confusing your question with one-hot-encoding. You should definitely take your labels and convert them to one-hot-encoding during both your training and prediction cycles. You're not changing your labels per-se, you're merely creating them in a way that allows you to better use them in neural networks (all neural networks; one-hot-encoding is not unique to LSTM).


Posted 2019-02-15T10:52:32.103

Reputation: 1 946

Thank you bro, but I am trying to use LSTM for stock prediction, so my inputs are different numbers(opening/high/low/close prices), and my labels are different numbers as well(like my input). In fact I am trying to predict tomorrow's prices, so I think I need labels with different numbers like my input not a one-hot-encoded vector. – user3486308 – 2019-02-15T16:05:24.177