Path: news.mathworks.com!not-for-mail
From: "zaheer ahmad" <ahmad.zaheer@yah00000.com>
Newsgroups: comp.soft-sys.matlab
Subject: Neural Networks Cant Generalize..Results error in New Data
Date: Thu, 4 Sep 2008 12:48:02 +0000 (UTC)
Organization: IMS
Lines: 79
Message-ID: <g9ole2$ins$1@fred.mathworks.com>
Reply-To: "zaheer ahmad" <ahmad.zaheer@yah00000.com>
NNTP-Posting-Host: webapp-05-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1220532482 19196 172.30.248.35 (4 Sep 2008 12:48:02 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Thu, 4 Sep 2008 12:48:02 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 706613
Xref: news.mathworks.com comp.soft-sys.matlab:488565



Hi all of you.
i got a problem in Neural  Networks.my net doesnt produce
required results when new data( test ) data is applied.it is
100% good in memorization..im not what  is the problem, can
any one help/suggest what is the actual problem...the code
goes as below:

clear;clc;

% SET CHARACTERS: 
alphabet =Alpha4Train();
targets=TargetSet();%eye(23);%

[Sa,Qa] = size(alphabet);
[S2,Q] = size(targets);
ValidatingChar=Alpha4Test();
TestMem=alphabet(:,77);
TestGen1=ValidatingChar(:,1);
TestGen2=ValidatingChar(:,2);
TestGen3=ValidatingChar(:,3);
% DEFINING THE NETWORK
% ====================
S1 = 100;%120          

net = newff(minmax(alphabet),[S1  S2],{'logsig' 'logsig'
'logsig'},'traingdx');%traingdx  traingdm  trainlm traincgf,
net.LW{2,1} = net.LW{2,1}*0.01;
net.b{2} = net.b{2}*0.01;


net.performFcn = 'sse'; % Sum-Squared Error performance function
net.trainParam.goal = 0.10; % Sum-squared error goal.
net.trainParam.show = 10; % Frequency of progress displays
(in epochs).
net.trainParam.epochs = 5000; % Maximum number of epochs to
train.
net.trainParam.mc = 0.95;%0.65;% % Momentum constant. 
mc=0.65 and s1=100 good memorization

% TRAINING THE NETWORK 
% ====================

P = alphabet;
T = targets;
[net,tr] = train(net,P,T);

% TRAINING THE NETWORK WITH NOISE.
%
=======================================================================
netn = net;
netn.trainParam.goal = 0.60; % Mean-squared error goal.
netn.trainParam.epochs = 1000;
T = [targets targets targets targets targets targets];
for pass = 1:20
P = [alphabet, alphabet, ...
(alphabet + randn(Sa,Qa)*0.1), ...
(alphabet + randn(Sa,Qa)*0.2), alphabet +
randn(Sa,Qa)*0.3,alphabet];

[netn,trn] = train(netn,P,T);
end

% SIMULATION OF THE NETWORK 
% ==========================

Y = sim(netnn,TestMem);  % 1 pe  &2 te 3 sheen  
Yy1 = sim(netnn,TestGen1);  % 1 pe  &2 te 3 sheen  
Yy2 = sim(netnn,TestGen2);  % 1 pe  &2 te 3 sheen  
Yy3 = sim(netnn,TestGen3);  % 1 pe  &2 te 3 sheen  
disp([round(Y) round(Yy1) round(Yy2)  round(Yy3)]);

first im training on ideal data then on some noisy data and
then check the results by applying the characters on which i
have trained the network and on some new data but it give
good results on data on which i have trained but wrong
results on new data....simple to say it is 100% good in
memorization but 100% wrong in generalization...how to
improve.....thanks in advance....zaheer ahmad