Multiple inputs using NEWFF

조회 수: 3 (최근 30일)
Joe
Joe 2011년 3월 16일
I am writing a program to generate a neural network using NEWFF.
I have 5 input variables (A through E) which are currently being input as an array:
input = [ A1 A2 A3 A4 A5
B1 B2 B3 B4 B5
C1 C2 C3 C4 C5
D1 D2 D3 D4 D5
E1 E2 E3 E4 E5 ];
There is 1 target vector:
target = [ T1 T2 T3 T4 T5 ];
I input this to NEWFF as:
net = newff( input, target );
I would think this would generate a network with 5 inputs and 1 output. However, no matter how I format the input variables the network is defined as having only 1 input.
Can anyone clarify what the issue is?
Thanks, Joe
P.S. I am using R2009B

답변 (4개)

Catherine DA GRACA
Catherine DA GRACA 2011년 4월 10일
Your input array only has one row in it - MATLAB ignores the line breaks. Use semi-colons to separate the values:
input = [ A1 A2 A3 A4 A5;
B1 B2 B3 B4 B5;
C1 C2 C3 C4 C5;
D1 D2 D3 D4 D5;
E1 E2 E3 E4 E5 ];
  댓글 수: 2
Walter Roberson
Walter Roberson 2011년 4월 10일
Not correct, Catherine.
>> [1 2 3 4 5
6 7 8 9 10
11 12 13 14 15]
ans =
1 2 3 4 5
6 7 8 9 10
11 12 13 14 15
When a line break is hint in an array and there is no continuation marker, it is treated as a vertical concatenation.
Joe
Joe 2011년 4월 11일
Catherine, the intent was not to convey the exact way I'd written the code, it was more to convey the fact that it I would have thought a 5 by 5 matrix would result in a system of 5 inputs, each consisting of elements, where it appears that that is not the case. In fact, the way the matrix is built in the code is much more complex.

댓글을 달려면 로그인하십시오.


Walter Roberson
Walter Roberson 2011년 4월 10일
Please recheck the documentation:
  • T SN x Q2 matrix of Q2 sample SN-element target vectors
Your target is 1 x 5 so SN is 1, so you are defining a network with a single input.
  댓글 수: 1
Joe
Joe 2011년 4월 12일
Thank you for your response Walter, but could you please elaborate? The way I read that line of the documentation is that The number of rows (SN) determines the number of elements in each output, while the number of columns (Q2) determines the number of samples per output... This does not impact the number of inputs fed to the network, and a quick test of the function bears this out (a dummy set of matrices run through newff, one with a T matrix which is 1x3 and the other which is 3x1, both result in a network with only 1 input)
Considering the variable P from the documentation, which is where I would expect the number of inputs to be determined:
P: R x Q1 matrix of Q1 sample R-element input vectors
R is the number of elements in each input and Q1 is number of samples... and no matter what the structure of this matrix is it doesn't seem to impact the "number of inputs".
I think I'm missing something fundamental here.

댓글을 달려면 로그인하십시오.


Kukuh
Kukuh 2012년 4월 25일
yes joe...I have same problem with you,,,my NN can't running when I use multi input like that. please help me.. thanks

Greg Heath
Greg Heath 2012년 4월 25일
[I N ] = size(p)
[O N ] =size(t)
net = newff(p,t,H);
Results in a FFMLP with I-H-O node topology.
Hope this helps.
Greg
  댓글 수: 1
Greg Heath
Greg Heath 2012년 4월 25일
I think what the documentation fails to make clear:
Regardless of the size of I and O, when you type the command
net
it will show only 1 (vector-valued/I-dimensional) input and 1 (vector-valued/O-dimensional) output.
Hope this helps
AND
Hope the documentation re this is modified in all of the many places
that it is (ab)used.
Greg

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Sequence and Numeric Feature Data Workflows에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by