Multiple input feedforward network

11 views (last 30 days)
Jana
Jana on 31 Mar 2012
I want to create a feedforward neural network with two input vectors and only one output vector. I've tried different things but I don't succeed.
I've tried:
P = [P1 P2];
net = newff(P,T);
But when I look at the architecture of the network it says:
numInputs: 1
Also when I try to train the network:
net = train(net,P,T);
I get the following error message:
??? Error using ==> network.train at 145
Targets are incorrectly sized for network.
Matrix must have 2 columns.
Error in ==> Problem1 at 90
net = train(net,P,T);
Is there anyone who can help me? I cannot seem to find a solution.
Maybe I should add: Both my input vectors (P1, P2) and also my target vector (T) have dimension [1000x1].
Jana

Accepted Answer

Greg Heath
Greg Heath on 1 Apr 2012
>I want to create a feedforward neural network with two input vectors and only one output vector. I've tried different things but I don't succeed.
>I've tried:
>P = [P1 P2];net = newff(P,T);
If P1 and P2 are 1-D column vectors, then you need a lot more data.
For an I-H-O feedforward net, with
[I N] =size(P)
[O N] = size(T)
Neq = N*O % No. of training equations
Nw = (I+1)*H+(H+1)*O % No. of unknown weights
To mitigate measurement error, noise and differences between training and nontraining data, is desirable to have Neq >> Nw which is equivalent to
N >> Nw/H
or
H << (Neq-O)/(I+O+1)
>But when I look at the architecture of the network it says: numInputs: 1
That is correct. 1 input of dimensionality I=size(P,1)
>Also when I try to train the network:
>net = train(net,P,T);
This assumes a default of H = 10
>I get the following error message:
>??? Error using ==> network.train at 145 >Targets are incorrectly sized for network. Matrix must have 2 columns. Error in ==> Problem1 at 90 net = train(net,P,T); >Is there anyone who can help me? I cannot seem to find a solution.
>Maybe I should add: Both my input vectors (P1, P2) and also my >target vector (T) have dimension [1000x1].
See above for correct sizes for P and T and constraint on size of H.
Hope this helps.
Greg
  2 Comments
Jana
Jana on 2 Apr 2012
I have trouble understanding your way of notating things.
What do you mean with [I N] and [O N]
I'm still altering the number of hidden neurons (and layers) in my network to find proper architecture.
Also I have transposed my vectors so now I have:
Input P [2x1000]
Target T [1x1000]
I hope this is the way to have two inputs in a network with one output?
Greg Heath
Greg Heath on 3 Apr 2012
You have answered your own question for a feedforward net with I-H-O (Input-Hidden-Output) node topology.
size(P)
size(T)
Greg

Sign in to comment.

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!