Sequence-to-Sequence Regression Using Deep Learning
Sequence-to-Sequence Regression Using Deep Learning
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".