# How do I create a neural network that will give multiple input and outputs?

27 Ansichten (letzte 30 Tage)
Junghyun Im am 22 Nov. 2019
Kommentiert: Ray ptucha am 24 Jan. 2021
Hi I am trying to design a ffnn neural network. I have input data of 900x4, and I want to design with output data of 900x2. Here's how I designed it: But you can't assign function output to this expression. Error occurs.
How do you solve this?
clear all; close all; clc;
[ I 4 ] = size(input)
[ O 2 ] = size(target)
input = [a(:,3) a(:,4) a(:,5) a(:,6)];
target = [a(:,1) a(:,2)];
net = feedforwardnet(10);
net = train(net, input', target');
y = net(input);
perf = perform(net,y,target)
##### 0 Kommentare-2 ältere Kommentare anzeigen-2 ältere Kommentare ausblenden

Melden Sie sich an, um zu kommentieren.

### Antworten (2)

Bhargavi Maganuru am 26 Nov. 2019
Inputs for the train should be R-by-Q matrix where R is input size and Q is batch size. Input size is 900x4 (Q- 900 and R-4) and target size is 900x2(Q-900 and R-2) in your case. So there is no issue with the below line
net = train (net, input', target');
But the lines
y = net(input);
perf = perform(net,y,target)
will give you an error because sizes don’t match. You could try using transpose for both input and target.
y = net(input');
perf = perform(net,y,target');
Hope this helps!
##### 0 Kommentare-2 ältere Kommentare anzeigen-2 ältere Kommentare ausblenden

Melden Sie sich an, um zu kommentieren.

Greg Heath am 1 Jan. 2020
ALWAYS arrange your data so that
[ I N ] = size(input)
[ O N ] = size(output)
Hope this helps.
Greg
##### 1 Kommentar-1 ältere Kommentare anzeigen-1 ältere Kommentare ausblenden
Ray ptucha am 24 Jan. 2021
Greg, I noticed that you have answered this question online numerous times- thank you. However, your answer is terse. It would be great if you could post a simple example so that users can step through it. One good example is at:
https://www.mathworks.com/help/deeplearning/ug/train-network-with-multiple-outputs.html
but requires 2020b, which most readers probably don't have yet...
Thank you.

Melden Sie sich an, um zu kommentieren.

### Kategorien

Mehr zu Get Started with Deep Learning Toolbox finden Sie in Help Center und File Exchange

R2019b

### Community Treasure Hunt

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

Start Hunting!

Translated by