0% found this document useful (0 votes)
41 views3 pages

Sequence-to-Sequence Regression Using Deep Learning

Uploaded by

milad.gholamifar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
41 views3 pages

Sequence-to-Sequence Regression Using Deep Learning

Uploaded by

milad.gholamifar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Regression LSTM Networks

Copy Code Copy Command


To create an LSTM network for sequence-to-one regression, create a layer array containing a
sequence input layer, an LSTM layer, and a fully connected layer.
Set the size of the sequence input layer to the number of features of the input data. Set the size of
the fully connected layer to the number of responses. You do not need to specify the sequence
length.
For the LSTM layer, specify the number of hidden units and the output mode "last".
Get
numFeatures = 12;
numHiddenUnits = 125;
numResponses = 1;

layers = [ ...
sequenceInputLayer(numFeatures)
lstmLayer(numHiddenUnits,OutputMode="last")
fullyConnectedLayer(numResponses)];
To create an LSTM network for sequence-to-sequence regression, use the same architecture as
for sequence-to-one regression, but set the output mode of the LSTM layer to "sequence".
Get
numFeatures = 12;
numHiddenUnits = 125;
numResponses = 1;

layers = [ ...
sequenceInputLayer(numFeatures)
lstmLayer(numHiddenUnits,OutputMode="sequence")
fullyConnectedLayer(numResponses)];
For an example showing how to train an LSTM network for sequence-to-sequence regression
and predict on new data, see Sequence-to-Sequence Regression Using Deep Learning.
Video Classification Network
Copy Code Copy Command
To create a deep learning network for data containing sequences of images such as video data
and medical images, specify image sequence input using the sequence input layer.
Specify the layers and create a dlnetwork object.
Get
inputSize = [64 64 3];
filterSize = 5;
numFilters = 20;
numHiddenUnits = 200;
numClasses = 10;

layers = [
sequenceInputLayer(inputSize)
convolution2dLayer(filterSize,numFilters)
batchNormalizationLayer
reluLayer
lstmLayer(numHiddenUnits,OutputMode="last")
fullyConnectedLayer(numClasses)
softmaxLayer];

net = dlnetwork(layers);
For an example showing how to train a deep learning network for video classification,
see Classify Videos Using Deep Learning.
Deeper LSTM Networks
Copy Code Copy Command
You can make LSTM networks deeper by inserting extra LSTM layers with the output
mode "sequence" before the LSTM layer. To prevent overfitting, you can insert dropout layers
after the LSTM layers.
For sequence-to-label classification networks, the output mode of the last LSTM layer must
be "last".

You might also like