Multi Input Multi Sequence Neural Network

16 views (last 30 days)
Kamuran Turksoy
Kamuran Turksoy on 25 Oct 2017
Edited: Kenta on 10 Sep 2021
The question is how to define a multi input multi sequence neural network (NN) in Matlab?
There is a way to define multi sequence NN:
x1 = [4 5 6];
x2 = [4 5 6];
y1 = [1 2 3];
y2 = [1 2 3];
x = {[x1;x2]};
y={[y1;y2]};
net = fitnet(1);
net = train(net,x,y);
view(net)
https://www.mathworks.com/help/nnet/ug/multiple-sequences-with-dynamic-neural-networks.html
There is also a way to define multi input NN:
x1 = [4 5 6];
x2 = [4 5 6];
y1 = [1 2 3];
y2 = [1 2 3];
x = {x1;x2};
y=y1;
net = fitnet(1);
net.numinputs = 2;
net.inputConnect = [1 1; 0 0];
net = train(net,x,y);
view(net)
https://www.mathworks.com/matlabcentral/answers/355286-how-to-give-multiple-inputs-to-the-train-function-of-neural-network
When I try to combine these two conditions:
x1 = [4 5 6];
x2 = [4 5 6];
y1 = [1 2 3];
y2 = [1 2 3];
x = {{[x1;x2]};{[x1;x2]}};
y={y1;y2};
net = fitnet(1);
net.numinputs = 2;
net.inputConnect = [1 1; 0 0];
net = train(net,x,y);
view(net)
I get error:
Error using nntraining.setup>setupPerWorker (line 61)
Inputs X{1,1} is not numeric or logical.
Error in nntraining.setup (line 43)
[net,data,tr,err] = setupPerWorker(net,trainFcn,X,Xi,Ai,T,EW,enableConfigure);
Error in network/train (line 335)
[net,data,tr,err] = nntraining.setup(net,net.trainFcn,X,Xi,Ai,T,EW,enableConfigure,isComposite);

Answers (1)

Kenta
Kenta on 10 Sep 2021
Edited: Kenta on 10 Sep 2021
As of now, you can use custom training loop for deep learning for the multi-input. This is a bit different from what you want, but I believe it helps you.
https://jp.mathworks.com/matlabcentral/fileexchange/74760-image-classification-using-cnn-with-multi-input-cnn

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!