Multiple input feedforward network
11 views (last 30 days)
Show older comments
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
0 Comments
Accepted Answer
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
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
More Answers (0)
See Also
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!