Multiple input (sequence and static) to a dag network

7 views (last 30 days)
I want to train a DAG_net with two inputs, the dag network is shown below:
My two inputs are : a sequential timeseries data with 17 features for 60 training examples. The other input is a static feature for the 60 training samples. Here is a screenshot of my training data
  1 Comment
Yildirim Kocoglu
Yildirim Kocoglu on 27 Nov 2020
Edited: Yildirim Kocoglu on 27 Nov 2020
Mona, have you by any chance solved this issue?
I'm trying to do the same exact thing with similar data as yours except my output is also a sequence.
I got the add/concatonate layer idea from a post I read online and a paper which shows the architecture as shown below:
My architecture looks similar to yours as below:
My training code looks something like this (to show it needs 2 inputs to train):
net = trainNetwork({XTrain(1:510,:);Static_features(1:510,:)'},YTrain(1:510,:),lgraph,options);
I use the same lgraph object as plotted above and XTrain (for temporal inputs) and Static_features (for static inputs) and a single output "YTrain" that should be a sequence similar to XTrain with multiple cells (similar to your XTrain). This is a prediction network that predicts the next time step value (YTrain) from the previous time step (XTrain).
However, when I try to train the network I get this error (next line of error says: if sequenceInputLayer is present, it can't accept any other type of input layer):
Network: Incompatible layer types. The network contains layer types not supported with recurrent layers.
Detected recurrent layers:
layer 'bilstm1' (BiLSTM)
layer 'bilstm2' (BiLSTM)
layer 'bilstm3' (BiLSTM)
layer 'bilstm4' (BiLSTM)
and 1 other layers.
For static_input I use an imageInputLayer but, I tried every layer that exists in Matlab 2020a (apparently featureInputLayer is not avaiable in 2020a) and it still gives me the same error.
I searched for every post I believe and can't seem to find a tutorial nor an example showing how to achieve this (if it is possible). The closest thing I found was using CNN-RNN but, that is with images (frames of a video) and has a single input layer.

Sign in to comment.

Answers (1)

Divya Gaddipati
Divya Gaddipati on 15 Apr 2020
Hi,
The latest version of MATLAB allows the training of networks with multiple inputs. Please refer to the following link for more information:
You can also use combineDatastore for this purpose.
Alternatively, you can also create a custom layer that accepts multiple inputs.
Hope this helps!

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!