LSTM network combined with BiLSTM
Show older comments
Hi everyone,
I'm working on a LSTM network for sequence regression. I have a large set of time-sequences with 24 features as inputs and 3 as outputs. The input is totally numeric and sequences have a varying length from 10 steps to more than 1000. Right now, the architecture is pretty simple:

In order to improve performance and because of the functioning of the system, it would made sense if one input was processed by a BiLSTM layer because it can be known in advance as shown in the example below:

However, using two sequenceInputLayer is not allowed by MATLAB. By surfing the forum, it was suggested to use imageInputLayer in order to allow two of them. I failed even in this case by implementing the following architecture:

It follows the code I'm using:
inputLay = imageInputLayer([1 numInput-1 1],'Normalization','zscore','NormalizationDimension','channel','Name','input Layer');
lstm1 = lstmLayer(128,'OutputMode','sequence','Name','LSTM Layer 1');
fullyConn1 = fullyConnectedLayer(32,'Name','Fully Conn 1');
fullyConnOut = fullyConnectedLayer(numOutput,'Name','Fully Conn Out');
outputLay = regressionLayer('Name','Output Layer');
concat = concatenationLayer(1,numInput,'Name','concat');
inputLayCurv = imageInputLayer([1 1 1],'Normalization','none','Name','curvature');
blstm1 = bilstmLayer(8,'OutputMode','sequence','Name','BiLSTM Layer 1');
flatten1=flattenLayer('Name','flatten1');
flatten2=flattenLayer('Name','flatten2');
% Architecture
layers=[
inputLay
flatten1
lstm1
concat
fullyConn1
fullyConnOut
outputLay
];
lgraph = layerGraph(layers);
lgraph = addLayers(lgraph,inputLayCurv);
lgraph = addLayers(lgraph,flatten2);
lgraph = addLayers(lgraph,blstm1);
lgraph = connectLayers(lgraph,'curvature','flatten2');
lgraph = connectLayers(lgraph,'flatten2','BiLSTM Layer 1');
lgraph = connectLayers(lgraph,'BiLSTM Layer 1','concat/in2');
It worth noting that training, validation and test sets are combinedDatastore given by two arrayDatastore where, for the first one, the first 23 inputs have to go in the 'input Layer' whereas the last input in 'curvature'. My question is if I'm doing something wrong regarding the architecture or if my idea can't be implemented in MATLAB. Thanks in advance to everyone for the help.
Accepted Answer
More Answers (0)
Categories
Find more on Deep Learning Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!