Path: news.mathworks.com!not-for-mail
From: "zaheer ahmad" <ahmad.zaheer@yah00000.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Neural Networks Cant Generalize..Results error in New Data
Date: Tue, 18 Nov 2008 19:03:02 +0000 (UTC)
Organization: IMS
Lines: 61
Message-ID: <gfv3h6$j7p$1@fred.mathworks.com>
References: <g9ole2$ins$1@fred.mathworks.com> <8436a506-ab26-4400-b349-3e2649bd757c@26g2000hsk.googlegroups.com> <gaaq75$1ro$1@fred.mathworks.com>
Reply-To: "zaheer ahmad" <ahmad.zaheer@yah00000.com>
NNTP-Posting-Host: webapp-03-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1227034982 19705 172.30.248.38 (18 Nov 2008 19:03:02 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Tue, 18 Nov 2008 19:03:02 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 706613
Xref: news.mathworks.com comp.soft-sys.matlab:501538


Dear Greg Heath thanks for your reply and sorry for my late response, i was busy in some other projects and didnt add this thread to my watchlist( i think)...
i implemented all your suggestions in my code and tested the code with various angles, but unfortunately i am having same problem.
1.  removed one logsig ( no doubt it was not required)
2. brackets () after function name is not required but matlab not warn or give error if written ( i used it by mistake....other languages habit...but now removed )
3. Number of Hidden layers were find out through hit and trial exercise.
4. i had already checked with ' sse '  and traingdm  trainlm traincgf but in vain.
5. i was looping ( 20 times ) just to get good result using increased random values( but i agree found unnecessary )
6. from new data i meant test data ( data on which net is not trained but similar to trained data)

My Project is about Urdu OCR...you might know about Urdu its national language of Pakistan..there is no lower case alphabets(atleast not like roman) in it. so be sure i am not trying to match up a,b against  A,B....

As stated earlier i have checked/implemented all your suggestions..but i think the problem is not in the training process/code....where? i am not sure....but i have the details of my project so sharing with you:
i am having 54 classes / patterns/alphabets on which trying to train the net....i have  trained the net once on  10 samples of each alphabet, checked results but not good, the same way trained the net on 25, samples and then on 50 samples of each pattern i.e.  a total of 540,1350,2700 samples . but the results are not encouraging (or say disappointing) and gives same result no matter how many samples are used. note that it converges on number of hidden layer=120 and also on =100.
The main problem i am facing is...the trained net can recognise/match alphabets on which it was trained but can not match similar data on which it was not trained on.

code with amendments is as below:

clear;clc;

% SET CHARACTERS: 
alphabet =Alpha4Train;
targets=TargetSet;
[Sa,Qa] = size(alphabet);
[S2,Q] =size(targets);
%%% Q=Qa
% DEFINING THE NETWORK
% ====================
S1 =120 ;  

net = newff(minmax(alphabet),[S1 S2],{'logsig' 'logsig'},'traingdx');
% i have checked for trainlm toooo

net.performFcn = 'sse'; % checked on mse tooo
net.trainParam.goal = 0.10;%checked on mean(var(targets))/100; 
net.trainParam.show = 20; % Frequency of progress displays (in epochs).
net.trainParam.epochs = 15000; %5000 Maximum number of epochs to train.
net.trainParam.mc = 0.5;%checked on 0.65 and 0.95 too

% TRAINING THE NETWORK 

P = alphabet;
T = targets;


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

% TRAINING THE NETWORK WITH NOISE...GET DIRTY FOR GOOD RESULTS AT THE END
netn = net;
netn.trainParam.goal = 0.60; 
netn.trainParam.epochs = 10000;%500
netn.trainParam.show = 20; %%% Frequency of progress displays (in epochs).
T = [targets targets targets];
P = [(alphabet + randn(Sa,Qa)*0.2), alphabet + randn(Sa,Qa)*0.3,alphabet];
[netn,trn] = train(netn,P,T);


I think i am having problem not in code and training algos but something else.

thanks 
zaheer ahmad
ahmad.zaheer (8) yahoo.com