How do we use LSTM to classify sequences?

我是研究僧i 提交于 2019-12-11 07:01:25

问题


LSTM is good for predicting what is going to happen after a sequence, but I assume that we have many sequences and that each sequence corresponds to a class label.

How can we use LSTM to classify these sequences?


回答1:


LSTM can be used for prediction as well as classification tasks.

For classification, you can follow most commonly used architectures that I have described below. However, you can build your own model depending on your requirement.

As the output of LSTM (Here I explain dynamic_rnn with time_major == False), we have a tensor with a shape of output = [batch_size, sequnce_length, cell.output_size], which means that for each row in the batch we have [sequnce_length, cell.output_size].

1. Method 1

1. Method 2

Hope this helps.



来源:https://stackoverflow.com/questions/46750692/how-do-we-use-lstm-to-classify-sequences

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!