Path: news.mathworks.com!not-for-mail
From: "Greg Heath" <heath@alumni.brown.edu>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Data division problem in neural network
Date: Sat, 27 Apr 2013 22:17:09 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 56
Message-ID: <klhip5$b63$1@newscl01ah.mathworks.com>
References: <kl6731$8a8$1@newscl01ah.mathworks.com>
Reply-To: "Greg Heath" <heath@alumni.brown.edu>
NNTP-Posting-Host: www-03-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: newscl01ah.mathworks.com 1367101029 11459 172.30.248.48 (27 Apr 2013 22:17:09 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Sat, 27 Apr 2013 22:17:09 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 2929937
Xref: news.mathworks.com comp.soft-sys.matlab:794453

"srishti" wrote in message <kl6731$8a8$1@newscl01ah.mathworks.com>...
> Hello,
>            I am using neural network pattern recognition for classification purpose.My problem is I am not getting whether for input and target both I have to write individual command      "trainInd,valInd,testInd] = divideind(Q,trainInd,valInd,testInd)" 
> and if yes then how to define parameters(net.divideparm)? I have written the following code.I have read the documentation but I am not able to clear my doubt. Please help.
>  
> s = RandStream('mcg16807','Seed', 0);
> RandStream.setDefaultStream(s)
> x=input; % size of x is 10x70
> t=target;% size of t is 3x70

[I N ] = size(x)  % [ 10 70 ]
[O N ] = size(t)  % [ 3 70 ]

% The default division ratios are 0.7/0.15/0.15
Ntst =round(0.15*N) % 11
Nval = Ntst               % 11
Ntrn = N-2*Ntst         % 48
trainind = 1:Ntst
valind = Ntrn+1:Ntrn+Nval
tstind = Ntrn+Nval+1:N
Ntrneq = Ntrn*O          % 144  No. of training equations

% No. of unknown weights
% Nw = (I+1)*H+(H+1)*O
% For more equations than unknowns H <= Hub

Hub= -1+ ceil( (Ntrneq -O) / (I+O+1) )  % 10

> net = patternnet(22);

No. Choose H by trial and error for  0 <= H <= 10

H = 5             % Prefer a loop H = 0:1:10
net = patternnet(H); % remove semicolon to see default parameter values

> net.divideFcn='divideInd';
> [trainInd,valInd,testInd] = divideind(x,1:20,35:45,54:65);

Replace x with N
Not sure why you are not using all of the data
[trainInd,valInd,testInd] = divideind(N,trnind,valind,tstind);

>  net.divideParam.trainInd = trainInd
>  net.divideParamvalInd = valInd
>  net.divideParam.testInd = testInd
>  net= train(net,x,t);

[ [ net tr y ] = train(net,x,t); % y is output

net = net     % See all of the input parameters

tr = tr          % See all of the training results.

Hope this helps.

Greg