How can recurrent neural networks be used for sequence classification?

RNN can be used for prediction, or sequence to sequence mapping. But how can RNN be used for classification? I mean, we give a whole sequence one label.


One can use RNN to map multiple input to a single input (label), as this give figure (source) illustrates:

enter image description here

Each rectangle is a vector and arrows represent functions (e.g. matrix multiply). Input vectors are in red, output vectors are in blue and green vectors hold the RNN’s state (more on this soon). From left to right: (1) Vanilla mode of processing without RNN, from fixed-sized input to fixed-sized output (e.g. image classification). (2) Sequence output (e.g. image captioning takes an image and outputs a sentence of words). (3) Sequence input (e.g. sentiment analysis where a given sentence is classified as expressing positive or negative sentiment). (4) Sequence input and sequence output (e.g. Machine Translation: an RNN reads a sentence in English and then outputs a sentence in French). (5) Synced sequence input and output (e.g. video classification where we wish to label each frame of the video). Notice that in every case are no pre-specified constraints on the lengths sequences because the recurrent transformation (green) is fixed and can be applied as many times as we like.

Source : Link , Question Author : user64003 , Answer Author : Franck Dernoncourt

Leave a Comment