<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/235521</link>
    <title>MATLAB Central Newsreader - Neural Networks Cant Generalize..Results error in New Data</title>
    <description>Feed for thread: Neural Networks Cant Generalize..Results error in New Data</description>
    <language>en-us</language>
    <copyright>&amp;copy;1994-2012 by MathWorks, Inc.</copyright>
    <webmaster>webmaster@mathworks.com</webmaster>
    <generator>MATLAB Central Newsreader</generator>
    <docs>http://blogs.law.harvard.edu/tech/rss</docs>
    <ttl>60</ttl>
    <image>
      <title>MathWorks</title>
      <url>http://www.mathworks.com/images/membrane_icon.gif</url>
    </image>
    <item>
      <pubDate>Thu, 04 Sep 2008 12:48:02 -0400</pubDate>
      <title>Neural Networks Cant Generalize..Results error in New Data</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/235521#598664</link>
      <author>zaheer ahmad</author>
      <description>Hi all of you.&lt;br&gt;
i got a problem in Neural  Networks.my net doesnt produce&lt;br&gt;
required results when new data( test ) data is applied.it is&lt;br&gt;
100% good in memorization..im not what  is the problem, can&lt;br&gt;
any one help/suggest what is the actual problem...the code&lt;br&gt;
goes as below:&lt;br&gt;
&lt;br&gt;
clear;clc;&lt;br&gt;
&lt;br&gt;
% SET CHARACTERS: &lt;br&gt;
alphabet =Alpha4Train();&lt;br&gt;
targets=TargetSet();%eye(23);%&lt;br&gt;
&lt;br&gt;
[Sa,Qa] = size(alphabet);&lt;br&gt;
[S2,Q] = size(targets);&lt;br&gt;
ValidatingChar=Alpha4Test();&lt;br&gt;
TestMem=alphabet(:,77);&lt;br&gt;
TestGen1=ValidatingChar(:,1);&lt;br&gt;
TestGen2=ValidatingChar(:,2);&lt;br&gt;
TestGen3=ValidatingChar(:,3);&lt;br&gt;
% DEFINING THE NETWORK&lt;br&gt;
% ====================&lt;br&gt;
S1 = 100;%120          &lt;br&gt;
&lt;br&gt;
net = newff(minmax(alphabet),[S1  S2],{'logsig' 'logsig'&lt;br&gt;
'logsig'},'traingdx');%traingdx  traingdm  trainlm traincgf,&lt;br&gt;
net.LW{2,1} = net.LW{2,1}*0.01;&lt;br&gt;
net.b{2} = net.b{2}*0.01;&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
net.performFcn = 'sse'; % Sum-Squared Error performance function&lt;br&gt;
net.trainParam.goal = 0.10; % Sum-squared error goal.&lt;br&gt;
net.trainParam.show = 10; % Frequency of progress displays&lt;br&gt;
(in epochs).&lt;br&gt;
net.trainParam.epochs = 5000; % Maximum number of epochs to&lt;br&gt;
train.&lt;br&gt;
net.trainParam.mc = 0.95;%0.65;% % Momentum constant. &lt;br&gt;
mc=0.65 and s1=100 good memorization&lt;br&gt;
&lt;br&gt;
% TRAINING THE NETWORK &lt;br&gt;
% ====================&lt;br&gt;
&lt;br&gt;
P = alphabet;&lt;br&gt;
T = targets;&lt;br&gt;
[net,tr] = train(net,P,T);&lt;br&gt;
&lt;br&gt;
% TRAINING THE NETWORK WITH NOISE.&lt;br&gt;
%&lt;br&gt;
=======================================================================&lt;br&gt;
netn = net;&lt;br&gt;
netn.trainParam.goal = 0.60; % Mean-squared error goal.&lt;br&gt;
netn.trainParam.epochs = 1000;&lt;br&gt;
T = [targets targets targets targets targets targets];&lt;br&gt;
for pass = 1:20&lt;br&gt;
P = [alphabet, alphabet, ...&lt;br&gt;
(alphabet + randn(Sa,Qa)*0.1), ...&lt;br&gt;
(alphabet + randn(Sa,Qa)*0.2), alphabet +&lt;br&gt;
randn(Sa,Qa)*0.3,alphabet];&lt;br&gt;
&lt;br&gt;
[netn,trn] = train(netn,P,T);&lt;br&gt;
end&lt;br&gt;
&lt;br&gt;
% SIMULATION OF THE NETWORK &lt;br&gt;
% ==========================&lt;br&gt;
&lt;br&gt;
Y = sim(netnn,TestMem);  % 1 pe  &amp;2 te 3 sheen  &lt;br&gt;
Yy1 = sim(netnn,TestGen1);  % 1 pe  &amp;2 te 3 sheen  &lt;br&gt;
Yy2 = sim(netnn,TestGen2);  % 1 pe  &amp;2 te 3 sheen  &lt;br&gt;
Yy3 = sim(netnn,TestGen3);  % 1 pe  &amp;2 te 3 sheen  &lt;br&gt;
disp([round(Y) round(Yy1) round(Yy2)  round(Yy3)]);&lt;br&gt;
&lt;br&gt;
first im training on ideal data then on some noisy data and&lt;br&gt;
then check the results by applying the characters on which i&lt;br&gt;
have trained the network and on some new data but it give&lt;br&gt;
good results on data on which i have trained but wrong&lt;br&gt;
results on new data....simple to say it is 100% good in&lt;br&gt;
memorization but 100% wrong in generalization...how to&lt;br&gt;
improve.....thanks in advance....zaheer ahmad</description>
    </item>
    <item>
      <pubDate>Thu, 11 Sep 2008 07:41:11 -0400</pubDate>
      <title>Re: Neural Networks Cant Generalize..Results error in New Data</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/235521#599811</link>
      <author>Greg Heath</author>
      <description>On Sep 4, 8:48=A0am, &quot;zaheer ahmad&quot; &amp;lt;ahmad.zah...@yah00000.com&amp;gt; wrote:&lt;br&gt;
&amp;gt; Hi all of you.&lt;br&gt;
&amp;gt; i got a problem inNeural=A0Networks.my net doesnt produce&lt;br&gt;
&amp;gt; required results when new data( test ) data is applied.it is&lt;br&gt;
&amp;gt; 100% good in memorization..im not what =A0is the problem, can&lt;br&gt;
&amp;gt; any one help/suggest what is the actual problem...the code&lt;br&gt;
&amp;gt; goes as below:&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; clear;clc;&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; % SET CHARACTERS:&lt;br&gt;
&amp;gt; alphabet =3DAlpha4Train();&lt;br&gt;
&amp;gt; targets=3DTargetSet();%eye(23);%&lt;br&gt;
&lt;br&gt;
Is the empty bracket notation valid?...I've never seen it before.&lt;br&gt;
&lt;br&gt;
&amp;gt; [Sa,Qa] =3D size(alphabet);&lt;br&gt;
&amp;gt; [S2,Q] =3D size(targets);&lt;br&gt;
&lt;br&gt;
Test to make sure that Q =3D Qa&lt;br&gt;
&lt;br&gt;
&amp;gt; ValidatingChar=3DAlpha4Test();&lt;br&gt;
&amp;gt; TestMem=3Dalphabet(:,77);&lt;br&gt;
&amp;gt; TestGen1=3DValidatingChar(:,1);&lt;br&gt;
&amp;gt; TestGen2=3DValidatingChar(:,2);&lt;br&gt;
&amp;gt; TestGen3=3DValidatingChar(:,3);&lt;br&gt;
&amp;gt; % DEFINING THE NETWORK&lt;br&gt;
&amp;gt; % =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D&lt;br&gt;
&amp;gt; S1 =3D 100;%120 =A0 =A0 =A0 =A0 =A0&lt;br&gt;
&lt;br&gt;
How did you determine this value for S1?? See my post on pretraining&lt;br&gt;
advice&lt;br&gt;
.&lt;br&gt;
Google Groups&lt;br&gt;
&lt;br&gt;
greg-heath pretraining-advice&lt;br&gt;
&lt;br&gt;
Sort by date to find the original post.&lt;br&gt;
&lt;br&gt;
Also see my posts on how to choose H (=3DS1.)&lt;br&gt;
&lt;br&gt;
greg-heath Neq Nw&lt;br&gt;
&lt;br&gt;
&amp;gt; net =3D newff(minmax(alphabet),[S1 =A0S2],{'logsig' 'logsig'&lt;br&gt;
&amp;gt; 'logsig'},'traingdx');%traingdx =A0traingdm =A0trainlm traincgf,&lt;br&gt;
&lt;br&gt;
Delete one of the logsigs. You only have two layers of weights.&lt;br&gt;
Do you really want the outputs to be restricted to the open&lt;br&gt;
interval (0,1)? If not, use the default 'purelin' for output.&lt;br&gt;
&lt;br&gt;
&amp;gt; net.LW{2,1} =3D net.LW{2,1}*0.01;&lt;br&gt;
&amp;gt; net.b{2} =3D net.b{2}*0.01;&lt;br&gt;
&lt;br&gt;
Delete the above. initialization is automatic.&lt;br&gt;
&lt;br&gt;
&amp;gt; net.performFcn =3D 'sse'; % Sum-Squared Error performance function&lt;br&gt;
&lt;br&gt;
Delete and use the default 'mse'.&lt;br&gt;
&lt;br&gt;
&amp;gt; net.trainParam.goal =3D 0.10; % Sum-squared error goal.&lt;br&gt;
&lt;br&gt;
Use mean(var(targets))/100 for the mse goal.&lt;br&gt;
&lt;br&gt;
&amp;gt; net.trainParam.show =3D 10; % Frequency of progress displays&lt;br&gt;
&amp;gt; (in epochs).&lt;br&gt;
&amp;gt; net.trainParam.epochs =3D 5000; % Maximum number of epochs to&lt;br&gt;
&amp;gt; train.&lt;br&gt;
&lt;br&gt;
Use the default of 100 with the default trainlm. If insufficient&lt;br&gt;
increase&lt;br&gt;
to  200 or more.&lt;br&gt;
&lt;br&gt;
&amp;gt; net.trainParam.mc =3D 0.95;%0.65;% % Momentum constant.&lt;br&gt;
&amp;gt; mc=3D0.65 and s1=3D100 good memorization&lt;br&gt;
&lt;br&gt;
Delete and use defaults of trainlm.&lt;br&gt;
&lt;br&gt;
&amp;gt; % TRAINING THE NETWORK&lt;br&gt;
&amp;gt; % =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; P =3D alphabet;&lt;br&gt;
&amp;gt; T =3D targets;&lt;br&gt;
&amp;gt; [net,tr] =3D train(net,P,T);&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; % TRAINING THE NETWORK WITH NOISE.&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
Why are you doing this??&lt;br&gt;
&lt;br&gt;
&amp;gt; =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=&lt;br&gt;
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=&lt;br&gt;
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D&lt;br&gt;
&amp;gt; netn =3D net;&lt;br&gt;
&amp;gt; netn.trainParam.goal =3D 0.60; % Mean-squared error goal.&lt;br&gt;
&lt;br&gt;
Before you used 'sse'?&lt;br&gt;
&lt;br&gt;
&amp;gt; netn.trainParam.epochs =3D 1000;&lt;br&gt;
&lt;br&gt;
Can make it much smaller if you use 'trainlm'&lt;br&gt;
&lt;br&gt;
&amp;gt; T =3D [targets targets targets targets targets targets];&lt;br&gt;
&lt;br&gt;
Wha?&lt;br&gt;
&lt;br&gt;
&amp;gt; for pass =3D 1:20&lt;br&gt;
&amp;gt; P =3D [alphabet, alphabet, ...&lt;br&gt;
&amp;gt; (alphabet + randn(Sa,Qa)*0.1), ...&lt;br&gt;
&amp;gt; (alphabet + randn(Sa,Qa)*0.2), alphabet +&lt;br&gt;
&amp;gt; randn(Sa,Qa)*0.3,alphabet];&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; [netn,trn] =3D train(netn,P,T);&lt;br&gt;
&amp;gt; end&lt;br&gt;
&lt;br&gt;
The above makes no sense. You are training the net 20 times&lt;br&gt;
but doing nothing with it the 1st 19 times...?&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&amp;gt; % SIMULATION OF THE NETWORK&lt;br&gt;
&amp;gt; % =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=&lt;br&gt;
=3D=3D=3D&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Y =3D sim(netnn,TestMem); =A0% 1 pe =A0&amp;2 te 3 sheen =A0&lt;br&gt;
&amp;gt; Yy1 =3D sim(netnn,TestGen1); =A0% 1 pe =A0&amp;2 te 3 sheen =A0&lt;br&gt;
&amp;gt; Yy2 =3D sim(netnn,TestGen2); =A0% 1 pe =A0&amp;2 te 3 sheen =A0&lt;br&gt;
&amp;gt; Yy3 =3D sim(netnn,TestGen3); =A0% 1 pe =A0&amp;2 te 3 sheen =A0&lt;br&gt;
&amp;gt; disp([round(Y) round(Yy1) round(Yy2) =A0round(Yy3)]);&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; first im training on ideal data then on some noisy data and&lt;br&gt;
&amp;gt; then check the results by applying the characters on which i&lt;br&gt;
&amp;gt; have trained the network and on some new data but it give&lt;br&gt;
&amp;gt; good results on data on which i have trained but wrong&lt;br&gt;
&amp;gt; results on new data....simple to say it is 100% good in&lt;br&gt;
&amp;gt; memorization but 100% wrong in generalization...how to&lt;br&gt;
&amp;gt; improve.....thanks in advance....zaheer ahmad&lt;br&gt;
&lt;br&gt;
Partition your data into separate training, validation and test&lt;br&gt;
subsets. The training set is used to estimate weights. The&lt;br&gt;
error on validation set is used to determine network (e.g., S1)&lt;br&gt;
and training algorithm paraneters 9e.g., No. of epochs).&lt;br&gt;
The generalization error is estimated via the error on the test set.&lt;br&gt;
&lt;br&gt;
If you want to see how robust the net is you can&lt;br&gt;
&lt;br&gt;
1. add random noise to the weights and plot test set error&lt;br&gt;
vs weight noise level&lt;br&gt;
2. add random noise to the test set inputs and plot test set error&lt;br&gt;
vs noise level using the original weights.&lt;br&gt;
&lt;br&gt;
Hope this helps.&lt;br&gt;
&lt;br&gt;
Greg</description>
    </item>
    <item>
      <pubDate>Thu, 11 Sep 2008 10:00:05 -0400</pubDate>
      <title>Re: Neural Networks Cant Generalize..Results error in New Data</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/235521#599829</link>
      <author>David </author>
      <description>Greg Heath &amp;lt;heath@alumni.brown.edu&amp;gt; wrote in message &amp;lt;8436a506-ab26-4400-b349-3e2649bd757c@26g2000hsk.googlegroups.com&amp;gt;...&lt;br&gt;
&amp;gt; On Sep 4, 8:48=A0am, &quot;zaheer ahmad&quot; &amp;lt;ahmad.zah...@yah00000.com&amp;gt; wrote:&lt;br&gt;
&amp;gt; &amp;gt; Hi all of you.&lt;br&gt;
&amp;gt; &amp;gt; i got a problem inNeural=A0Networks.my net doesnt produce&lt;br&gt;
&amp;gt; &amp;gt; required results when new data( test ) data is applied.it is&lt;br&gt;
&amp;gt; &amp;gt; 100% good in memorization..im not what =A0is the problem, can&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
Besides the technical training suggestion... what do you mean by 'new data'?  how is the 'new data' related to the training data?  nn's are not great generalizers, they do essentially memorize patterns they are trained with and then take unknown patterns and figure out how they fit into the set of known patterns.  i.e. if you train a nn with images for 'A' 'B' 'C' then present it with unknown image 'a' or 'b' it might perform poorly, but is may match up 'c' because it is basically the same shape as 'C'.</description>
    </item>
    <item>
      <pubDate>Tue, 18 Nov 2008 19:03:02 -0500</pubDate>
      <title>Re: Neural Networks Cant Generalize..Results error in New Data</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/235521#611614</link>
      <author>zaheer ahmad</author>
      <description>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)...&lt;br&gt;
i implemented all your suggestions in my code and tested the code with various angles, but unfortunately i am having same problem.&lt;br&gt;
1.  removed one logsig ( no doubt it was not required)&lt;br&gt;
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 )&lt;br&gt;
3. Number of Hidden layers were find out through hit and trial exercise.&lt;br&gt;
4. i had already checked with ' sse '  and traingdm  trainlm traincgf but in vain.&lt;br&gt;
5. i was looping ( 20 times ) just to get good result using increased random values( but i agree found unnecessary )&lt;br&gt;
6. from new data i meant test data ( data on which net is not trained but similar to trained data)&lt;br&gt;
&lt;br&gt;
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....&lt;br&gt;
&lt;br&gt;
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:&lt;br&gt;
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.&lt;br&gt;
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.&lt;br&gt;
&lt;br&gt;
code with amendments is as below:&lt;br&gt;
&lt;br&gt;
clear;clc;&lt;br&gt;
&lt;br&gt;
% SET CHARACTERS: &lt;br&gt;
alphabet =Alpha4Train;&lt;br&gt;
targets=TargetSet;&lt;br&gt;
[Sa,Qa] = size(alphabet);&lt;br&gt;
[S2,Q] =size(targets);&lt;br&gt;
%%% Q=Qa&lt;br&gt;
% DEFINING THE NETWORK&lt;br&gt;
% ====================&lt;br&gt;
S1 =120 ;  &lt;br&gt;
&lt;br&gt;
net = newff(minmax(alphabet),[S1 S2],{'logsig' 'logsig'},'traingdx');&lt;br&gt;
% i have checked for trainlm toooo&lt;br&gt;
&lt;br&gt;
net.performFcn = 'sse'; % checked on mse tooo&lt;br&gt;
net.trainParam.goal = 0.10;%checked on mean(var(targets))/100; &lt;br&gt;
net.trainParam.show = 20; % Frequency of progress displays (in epochs).&lt;br&gt;
net.trainParam.epochs = 15000; %5000 Maximum number of epochs to train.&lt;br&gt;
net.trainParam.mc = 0.5;%checked on 0.65 and 0.95 too&lt;br&gt;
&lt;br&gt;
% TRAINING THE NETWORK &lt;br&gt;
&lt;br&gt;
P = alphabet;&lt;br&gt;
T = targets;&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
[net,tr] = train(net,P,T);&lt;br&gt;
&lt;br&gt;
% TRAINING THE NETWORK WITH NOISE...GET DIRTY FOR GOOD RESULTS AT THE END&lt;br&gt;
netn = net;&lt;br&gt;
netn.trainParam.goal = 0.60; &lt;br&gt;
netn.trainParam.epochs = 10000;%500&lt;br&gt;
netn.trainParam.show = 20; %%% Frequency of progress displays (in epochs).&lt;br&gt;
T = [targets targets targets];&lt;br&gt;
P = [(alphabet + randn(Sa,Qa)*0.2), alphabet + randn(Sa,Qa)*0.3,alphabet];&lt;br&gt;
[netn,trn] = train(netn,P,T);&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
I think i am having problem not in code and training algos but something else.&lt;br&gt;
&lt;br&gt;
thanks &lt;br&gt;
zaheer ahmad&lt;br&gt;
ahmad.zaheer (8) yahoo.com</description>
    </item>
    <item>
      <pubDate>Thu, 20 Nov 2008 06:05:03 -0500</pubDate>
      <title>Re: Neural Networks Cant Generalize..Results error in New Data</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/235521#612008</link>
      <author>zaheer ahmad</author>
      <description>i think the main problem is in the number of samples......kindly some one reply its urgent...thanks</description>
    </item>
    <item>
      <pubDate>Tue, 02 Dec 2008 22:06:26 -0500</pubDate>
      <title>Re: Neural Networks Cant Generalize..Results error in New Data</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/235521#614583</link>
      <author>Greg Heath</author>
      <description>On Nov 18, 2:03 pm, &quot;zaheer ahmad&quot; &amp;lt;ahmad.zah...@yah00000.com&amp;gt; wrote:&lt;br&gt;
&amp;gt; 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)...&lt;br&gt;
&amp;gt; i implemented all your suggestions in my code and tested the code with various angles, but unfortunately i am having same problem.&lt;br&gt;
&amp;gt; 1.  removed one logsig ( no doubt it was not required)&lt;br&gt;
&amp;gt; 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 )&lt;br&gt;
&amp;gt; 3. Number of Hidden layers were find out through hit and trial exercise.&lt;br&gt;
&amp;gt; 4. i had already checked with ' sse '  and traingdm  trainlm traincgf but in vain.&lt;br&gt;
&amp;gt; 5. i was looping ( 20 times ) just to get good result using increased random values( but i agree found unnecessary )&lt;br&gt;
&amp;gt; 6. from new data i meant test data ( data on which net is not trained but similar to trained data)&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; 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....&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; 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:&lt;br&gt;
&amp;gt; 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.&lt;br&gt;
&amp;gt; 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.&lt;br&gt;
&lt;br&gt;
Maybe your classes are not well defined&lt;br&gt;
and have to be partitioned into subclasses&lt;br&gt;
via clustering (e.g., k-means).&lt;br&gt;
&lt;br&gt;
Overlay the plot of each misclassified character&lt;br&gt;
(blue) on the plot of the mean of the class to&lt;br&gt;
which they were assigned (red) and the plot of&lt;br&gt;
the mean of the correct class (black)clustering.&lt;br&gt;
&lt;br&gt;
This should give some insight into the difficulty.&lt;br&gt;
&lt;br&gt;
&amp;gt; code with amendments is as below:&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; clear;clc;&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; % SET CHARACTERS:&lt;br&gt;
&amp;gt; alphabet =Alpha4Train;&lt;br&gt;
&amp;gt; targets=TargetSet;&lt;br&gt;
&amp;gt; [Sa,Qa] = size(alphabet);&lt;br&gt;
&amp;gt; [S2,Q] =size(targets);&lt;br&gt;
&lt;br&gt;
Well, what are they?&lt;br&gt;
&lt;br&gt;
&amp;gt; %%% Q=Qa&lt;br&gt;
&amp;gt; % DEFINING THE NETWORK&lt;br&gt;
&amp;gt; % ====================&lt;br&gt;
&amp;gt; S1 =120 ;&lt;br&gt;
&lt;br&gt;
How did you determine this?&lt;br&gt;
&lt;br&gt;
&amp;gt; net =newff(minmax(alphabet),[S1 S2],{'logsig' 'logsig'},'traingdx');&lt;br&gt;
&lt;br&gt;
Why not standardize the inputs and use&lt;br&gt;
tansig in the hidden layer?&lt;br&gt;
&lt;br&gt;
&amp;gt; % i have checked for trainlm toooo&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; net.performFcn = 'sse'; % checked on mse tooo&lt;br&gt;
&lt;br&gt;
Forget sse&lt;br&gt;
&lt;br&gt;
&amp;gt; net.trainParam.goal = 0.10;%checked on mean(var(targets))/100;&lt;br&gt;
&lt;br&gt;
Looks too high. Probably something wrong.&lt;br&gt;
&lt;br&gt;
&amp;gt; net.trainParam.show = 20; % Frequency of progress displays (in epochs).&lt;br&gt;
&amp;gt; net.trainParam.epochs = 15000; %5000 Maximum number of epochs to train.&lt;br&gt;
&amp;gt; net.trainParam.mc = 0.5;%checked on 0.65 and 0.95 too&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; % TRAINING THE NETWORK&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; P = alphabet;&lt;br&gt;
&amp;gt; T = targets;&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; [net,tr] = train(net,P,T);&lt;br&gt;
&lt;br&gt;
Where is your error calculation?&lt;br&gt;
&lt;br&gt;
&amp;gt; % TRAINING THE NETWORK WITH NOISE...GET DIRTY FOR GOOD RESULTS AT THE END&lt;br&gt;
&amp;gt; netn = net;&lt;br&gt;
&amp;gt; netn.trainParam.goal = 0.60;&lt;br&gt;
&amp;gt; netn.trainParam.epochs = 10000;%500&lt;br&gt;
&amp;gt; netn.trainParam.show = 20; %%% Frequency of progress displays (in epochs).&lt;br&gt;
&amp;gt; T = [targets targets targets];&lt;br&gt;
&amp;gt; P = [(alphabet + randn(Sa,Qa)*0.2), alphabet + randn(Sa,Qa)*0.3,alphabet];&lt;br&gt;
&lt;br&gt;
The noise has to be scaled to the standard deviation&lt;br&gt;
of the signal. Have you actually looked at these noisy&lt;br&gt;
characters?&lt;br&gt;
&lt;br&gt;
Q ~= Qa.&lt;br&gt;
&lt;br&gt;
&amp;gt; [netn,trn] = train(netn,P,T);&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; I think i am having problem not in code and training algos but something else.&lt;br&gt;
&lt;br&gt;
Concentrate on the noiseless characters.&lt;br&gt;
&lt;br&gt;
Hope this helps.&lt;br&gt;
&lt;br&gt;
Greg</description>
    </item>
    <item>
      <pubDate>Sat, 06 Dec 2008 21:00:17 -0500</pubDate>
      <title>Re: Neural Networks Cant Generalize..Results error in New Data</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/235521#615465</link>
      <author>zaheer ahmad</author>
      <description>This problem is rehashed and asked/posted on &lt;br&gt;
&lt;a href=&quot;http://www.mathworks.com/matlabcentral/newsreader/view_thread/240079#614596&quot;&gt;http://www.mathworks.com/matlabcentral/newsreader/view_thread/240079#614596&lt;/a&gt;&lt;br&gt;
because i was not patientless to get replies from here....sorry for inconvenience....&lt;br&gt;
&lt;br&gt;
zaheer ahmad</description>
    </item>
  </channel>
</rss>

