<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/240079</link>
    <title>MATLAB Central Newsreader - MLP Optimization Problem ( generalization problem ) -- on OCR data--Urdu</title>
    <description>Feed for thread: MLP Optimization Problem ( generalization problem ) -- on OCR data--Urdu</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>Fri, 28 Nov 2008 17:45:04 -0500</pubDate>
      <title>MLP Optimization Problem ( generalization problem ) -- on OCR data--Urdu</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/240079#613746</link>
      <author>zaheer ahmad</author>
      <description>Dear All&lt;br&gt;
&lt;br&gt;
I am developing an OCR (Urdu) but having 'goal doesnt meet' problem.&lt;br&gt;
&lt;br&gt;
my network is&lt;br&gt;
&lt;br&gt;
Input =400 also reduced and checked on 100 and 144&lt;br&gt;
output=54&lt;br&gt;
Hidden layer = 20 but checked on 30,40,50,60,70,80,90,100 upto 250&lt;br&gt;
&lt;br&gt;
Sample size i tried to train th net are &lt;br&gt;
5400   (i.e. 100*54=5400) but also checked on &lt;br&gt;
540    (i.e. 10*54=540) and &lt;br&gt;
1080   (i.e. 20*54=1080) and&lt;br&gt;
1350   (i.e. 25*54=1350) and&lt;br&gt;
2700   (i.e. 50*54=2700)&lt;br&gt;
where 54 are the number of character and 100,10,20,25 and 50 are samples of each character. &lt;br&gt;
&lt;br&gt;
i tried on using traingdx, trainlm and trainscg( because of out of memory error ) with both   mse and sse.&lt;br&gt;
&lt;br&gt;
i dont know why it doesnt reach to the gaol the goal=0.1 for traingdx (or goal= 0.009 for tranlm)&lt;br&gt;
some time it reach to goal but doesnt recognise test data.&lt;br&gt;
&lt;br&gt;
the code is given as below:&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
clear;clc;&lt;br&gt;
&lt;br&gt;
% SET CHARACTERS: &lt;br&gt;
Alphabet =Alpha4Train;%Alphabet =Alphabet(:,1:100);&lt;br&gt;
Target=TargetSet;%Target=Target(1:100);&lt;br&gt;
[S1,Qa] = size(Alphabet);&lt;br&gt;
[S2,Q] =size(Target);&lt;br&gt;
&lt;br&gt;
% DEFINING THE NETWORK&lt;br&gt;
% ====================&lt;br&gt;
H1 =120 ;%115=10  120=0 with mc=0.5   120=2...80....200=met for 10 char ...150     120  for 10 alphas        &lt;br&gt;
&lt;br&gt;
net = newff(minmax(Alphabet),[H1 S2],{'logsig' 'logsig'},'traingdx');%trainrp  trainscg&lt;br&gt;
%%%%traingdx  traingdm  trainlm traincgf,   net = newff(minmax(alphabet),[S1 S2],{'logsig' 'logsig'},'traingdx');&lt;br&gt;
&lt;br&gt;
net.performFcn = 'sse'; % sse   Sum-Squared Error performance function&lt;br&gt;
net.trainParam.goal =0.10;% mean(var(Target))/100; %0.10;% 0.009;% Sum-squared error goal.&lt;br&gt;
net.trainParam.show = 10; % Frequency of progress displays (in epochs).&lt;br&gt;
net.trainParam.epochs = 95000; %5000 Maximum number of epochs to train.&lt;br&gt;
%  net.trainParam.mc = 0.95;%0.65;% % Momentum constant.  mc=0.65 and s1=100 good memorization&lt;br&gt;
%  net.trainParam.mem_reduc =99999;&lt;br&gt;
% net.trainParam.lr=0.01;%Learning rate&lt;br&gt;
% net.trainParam.lr_inc=1.9;&lt;br&gt;
% net.trainParam.lr_dec = 0.5;&lt;br&gt;
&lt;br&gt;
% TRAINING THE NETWORK &lt;br&gt;
% ====================&lt;br&gt;
&lt;br&gt;
P = [Alphabet,Alphabet,Alphabet,Alphabet,Alphabet,Alphabet,Alphabet];&lt;br&gt;
T = [Target,Target,Target,Target,Target,Target,Target];&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;
% =======================================================================&lt;br&gt;
netn = net;&lt;br&gt;
netn.trainParam.goal =0.01;% mean(var(Target))/100; %0.009;%mean(var(Target))/100; % Mean-squared error goal.&lt;br&gt;
netn.trainParam.epochs = 85000;%500&lt;br&gt;
netn.trainParam.show = 10; %%% Frequency of progress displays (in epochs).&lt;br&gt;
&lt;br&gt;
T = [Target,Target,Target,Target,Target,Target,Target];&lt;br&gt;
P = [(Alphabet + randn(S1,Qa)*0.2), Alphabet + randn(S1,Qa)*0.3, Alphabet + randn(S1,Qa)*0.3,Alphabet,Alphabet,&lt;br&gt;
&lt;br&gt;
(Alphabet + randn(S1,Qa)*0.2), Alphabet + randn(S1,Qa)*0.3];&lt;br&gt;
[netn,trn] = train(netn,Alphabet,Target);&lt;br&gt;
&lt;br&gt;
%   load netxxx1010; ImProc(netn,net);&lt;br&gt;
&lt;br&gt;
save netgdx2115;&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
%%%%%%%%%%&lt;br&gt;
i have only 100 samples for each character to i have used &lt;br&gt;
&lt;br&gt;
P = [Alphabet,Alphabet,Alphabet,Alphabet,Alphabet,Alphabet,Alphabet];&lt;br&gt;
&lt;br&gt;
to the get inequality &lt;br&gt;
&lt;br&gt;
Neq &amp;gt;~ r* Nw       where (~2 &amp;lt; r &amp;lt; ~ 64).    as described by Greg Heath in posts.&lt;br&gt;
so it doesnt need to tell that i have tried to follow Greg Heath rule rule for choosing hidden layer.&lt;br&gt;
even tried to overrule it some times but all in vain.&lt;br&gt;
&lt;br&gt;
the comments in the code shows the values i have tested, so i have not omitted the comments for yours&lt;br&gt;
reading despite it make the code reading a bit difficult, hope no one will mind.&lt;br&gt;
&lt;br&gt;
thanks&lt;br&gt;
zaheer ahmad&lt;br&gt;
&lt;br&gt;
&amp;nbsp;</description>
    </item>
    <item>
      <pubDate>Tue, 02 Dec 2008 22:57:13 -0500</pubDate>
      <title>Re: MLP Optimization Problem ( generalization problem ) -- on OCR </title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/240079#614596</link>
      <author>Greg Heath</author>
      <description>On Nov 28, 12:45 pm, &quot;zaheer ahmad&quot; &amp;lt;ahmad.zah...@yah00000.com&amp;gt; wrote:&lt;br&gt;
&amp;gt; Dear All&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; I am developing an OCR (Urdu) but having 'goal doesnt meet' problem.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; my network is&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Input =400 also reduced and checked on 100 and 144&lt;br&gt;
&amp;gt; output=54&lt;br&gt;
&amp;gt; Hidden layer = 20 but checked on 30,40,50,60,70,80,90,100 upto 250&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Sample size i tried to train th net are&lt;br&gt;
&amp;gt; 5400   (i.e. 100*54=5400) but also checked on&lt;br&gt;
&amp;gt; 540    (i.e. 10*54=540) and&lt;br&gt;
&amp;gt; 1080   (i.e. 20*54=1080) and&lt;br&gt;
&amp;gt; 1350   (i.e. 25*54=1350) and&lt;br&gt;
&amp;gt; 2700   (i.e. 50*54=2700)&lt;br&gt;
&amp;gt; where 54 are the number of character and 100,10,20,25 and 50 are samples of each character&lt;br&gt;
&lt;br&gt;
So you have&lt;br&gt;
&lt;br&gt;
size(p) = [400 Ntrn] for a character with 20*20 = 400 pixels&lt;br&gt;
size(t)  = [54 Ntrn] for 54 letters, integers and special characters?&lt;br&gt;
&lt;br&gt;
&amp;gt; i tried on using traingdx, trainlm and trainscg( because of out of memory error ) with both   mse and sse.&lt;br&gt;
&lt;br&gt;
Forget sse&lt;br&gt;
&lt;br&gt;
&amp;gt; i dont know why it doesnt reach to the gaol the goal=0.1 for traingdx (or goal= 0.009 for tranlm)&lt;br&gt;
&lt;br&gt;
Why the difference? How were the goals determined?&lt;br&gt;
&lt;br&gt;
&amp;gt; some time it reach to goal but doesnt recognise test data.&lt;br&gt;
&lt;br&gt;
How similar are testing and training sets?&lt;br&gt;
&lt;br&gt;
Clustering and visualizing the data should help.&lt;br&gt;
&lt;br&gt;
&amp;gt; the code is given 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;%Alphabet =Alphabet(:,1:100);&lt;br&gt;
&amp;gt; Target=TargetSet;%Target=Target(1:100);&lt;br&gt;
&lt;br&gt;
??&lt;br&gt;
5400 not 100&lt;br&gt;
&lt;br&gt;
&amp;gt; [S1,Qa] = size(Alphabet);&lt;br&gt;
&lt;br&gt;
[400 5400]&lt;br&gt;
&lt;br&gt;
&amp;gt; [S2,Q] =size(Target);&lt;br&gt;
&lt;br&gt;
[54 5400]&lt;br&gt;
&lt;br&gt;
if Q ~= Qa, error, end&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&amp;gt; % DEFINING THE NETWORK&lt;br&gt;
&amp;gt; % ====================&lt;br&gt;
&amp;gt; H1 =120 ;%115=10  120=0 with mc=0.5   120=2...80....200=met for 10 char ...150     120  for 10 alphas&lt;br&gt;
&lt;br&gt;
I have no idea what the comment is supposed to mean.&lt;br&gt;
&lt;br&gt;
Nw = (400+1)*120+(120+1)*54 = 54+(1+400+54)*120 = 54,654&lt;br&gt;
Neq = 5400*54 = 291,600 ~ 5.3*Nw&lt;br&gt;
&lt;br&gt;
Would have prefered a higher ratio.&lt;br&gt;
&lt;br&gt;
&amp;gt; net =newff(minmax(Alphabet),[H1 S2],{'logsig' 'logsig'},'traingdx');%trainrp  trainscg&lt;br&gt;
&lt;br&gt;
Why not standardize inputs and use tansig hidden nodes??&lt;br&gt;
&lt;br&gt;
&amp;gt; %%%%traingdx  traingdm  trainlm traincgf,   net =newff(minmax(alphabet),[S1 S2],{'logsig' 'logsig'},'traingdx');&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; net.performFcn = 'sse'; % sse   Sum-Squared Error performance function&lt;br&gt;
&lt;br&gt;
Why not use mse??&lt;br&gt;
&lt;br&gt;
&amp;gt; net.trainParam.goal =0.10;% mean(var(Target))/100; %0.10;% 0.009;% Sum-squared error goal.&lt;br&gt;
&lt;br&gt;
??&lt;br&gt;
&lt;br&gt;
c = 54&lt;br&gt;
mean(Target) = [ 1 + (c-1)*0]/c = 1/c = 1/54 = 1.85e-2&lt;br&gt;
mean(var(Target)) = [(1-1/c)^2 + (c-1)*(0-1/c)^2]/(c-1) = 1/c&lt;br&gt;
&lt;br&gt;
net.trainParam.goal  = 1.85e-4     % MSE&lt;br&gt;
&lt;br&gt;
&amp;gt; net.trainParam.show = 10; % Frequency of progress displays (in epochs).&lt;br&gt;
&amp;gt; net.trainParam.epochs = 95000; %5000 Maximum number of epochs to train.&lt;br&gt;
&amp;gt; %  net.trainParam.mc = 0.95;%0.65;% % Momentum constant.  mc=0.65 and s1=100 good memorization&lt;br&gt;
&lt;br&gt;
H = S1?&lt;br&gt;
&lt;br&gt;
&amp;gt; %  net.trainParam.mem_reduc =99999;&lt;br&gt;
&amp;gt; % net.trainParam.lr=0.01;%Learning rate&lt;br&gt;
&amp;gt; % net.trainParam.lr_inc=1.9;&lt;br&gt;
&amp;gt; % net.trainParam.lr_dec = 0.5;&lt;br&gt;
&lt;br&gt;
I use trainlm or trainscg and only specify goal,&lt;br&gt;
show and (rarely) epochs.&lt;br&gt;
So, I can't comment on the other settings.&lt;br&gt;
&lt;br&gt;
&amp;gt; % TRAINING THE NETWORK&lt;br&gt;
&amp;gt; % ====================&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; P = [Alphabet,Alphabet,Alphabet,Alphabet,Alphabet,Alphabet,Alphabet];&lt;br&gt;
&amp;gt; T = [Target,Target,Target,Target,Target,Target,Target];&lt;br&gt;
&lt;br&gt;
This doesn't make sense.&lt;br&gt;
&lt;br&gt;
&amp;gt; [net,tr] = train(net,P,T);&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; % TRAINING THE NETWORK WITH NOISE...GET DIRTY FOR GOOD RESULTS AT THE END&lt;br&gt;
&lt;br&gt;
This is called Jittering. Go to Google groups and search on&lt;br&gt;
&lt;br&gt;
greg-heath jittering&lt;br&gt;
&lt;br&gt;
&amp;gt; % =======================================================================&lt;br&gt;
&amp;gt; netn = net;&lt;br&gt;
&amp;gt; netn.trainParam.goal =0.01;% mean(var(Target))/100; %0.009;%mean(var(Target))/100; % Mean-squared error goal.&lt;br&gt;
&lt;br&gt;
Revisit this.&lt;br&gt;
&lt;br&gt;
&amp;gt; netn.trainParam.epochs = 85000;%500&lt;br&gt;
&amp;gt; netn.trainParam.show = 10; %%% Frequency of progress displays (in epochs).&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; T = [Target,Target,Target,Target,Target,Target,Target];&lt;br&gt;
&amp;gt; P = [(Alphabet + randn(S1,Qa)*0.2), Alphabet + randn(S1,Qa)*0.3, Alphabet + &amp;gt; randn(S1,Qa)*0.3,Alphabet,Alphabet,&lt;br&gt;
&amp;gt; (Alphabet + randn(S1,Qa)*0.2), Alphabet + randn(S1,Qa)*0.3];&lt;br&gt;
&amp;gt; [netn,trn] = train(netn,Alphabet,Target);&lt;br&gt;
&lt;br&gt;
Since Neq/Nw ~ 5. Probably don't need to increase Ntrn&lt;br&gt;
by more than a factor of 2 to 4.&lt;br&gt;
&lt;br&gt;
Use only one noise level and scale it to the&lt;br&gt;
standard deviation of Alphabet in order to get&lt;br&gt;
a specified SNR.&lt;br&gt;
&lt;br&gt;
&amp;gt; %   load netxxx1010; ImProc(netn,net);&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; save netgdx2115;&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; %%%%%%%%%%&lt;br&gt;
&amp;gt; i have only 100 samples for each character to i have used&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; P = [Alphabet,Alphabet,Alphabet,Alphabet,Alphabet,Alphabet,Alphabet];&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; to the get inequality&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Neq &amp;gt;~ r* Nw       where (~2 &amp;lt; r &amp;lt; ~ 64).    as described by Greg Heath in posts.&lt;br&gt;
&amp;gt; so it doesnt need to tell that i have tried to follow Greg Heath rule rule for choosing hidden layer.&lt;br&gt;
&amp;gt; even tried to overrule it some times but all in vain.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; the comments in the code shows the values i have tested, so i have not omitted the comments for yours&lt;br&gt;
&amp;gt; reading despite it make the code reading a bit difficult, hope no one will mind.&lt;br&gt;
&lt;br&gt;
You should overlay plots of misclassified characters&lt;br&gt;
with plots of means of the correct and assigned classes.&lt;br&gt;
Perhaps the classes are not defined well enough and&lt;br&gt;
you may need to use clustering to create well defined&lt;br&gt;
subclasses.&lt;br&gt;
&lt;br&gt;
You can also replace forced classification (always&lt;br&gt;
make a classification) with conditional classification&lt;br&gt;
(only make a classification if the posterior estimate&lt;br&gt;
is larger than a threshold). To do this, overlay the&lt;br&gt;
color coded histograms of the output for the classes&lt;br&gt;
that get the most confused.&lt;br&gt;
&lt;br&gt;
Go to Google Groups and search on&lt;br&gt;
&lt;br&gt;
greg-heath forced-classification&lt;br&gt;
greg-heath conditional-classification&lt;br&gt;
&lt;br&gt;
Hope this helps.&lt;br&gt;
&lt;br&gt;
Greg</description>
    </item>
    <item>
      <pubDate>Sat, 06 Dec 2008 20:54:02 -0500</pubDate>
      <title>Re: MLP Optimization Problem ( generalization problem ) -- on OCR</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/240079#615464</link>
      <author>zaheer ahmad</author>
      <description>Greg Heath &amp;lt;heath@alumni.brown.edu&amp;gt; wrote in message &amp;lt;e9dc5bcb-cf3d-4a6f-9fdd-d4ea0b8ee6a9@d23g2000yqc.googlegroups.com&amp;gt;...&lt;br&gt;
&amp;gt; On Nov 28, 12:45 pm, &quot;zaheer ahmad&quot; &amp;lt;ahmad.zah...@yah00000.com&amp;gt; wrote:&lt;br&gt;
&amp;gt; &amp;gt; Dear All&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; I am developing an OCR (Urdu) but having 'goal doesnt meet' problem.&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; my network is&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; Input =400 also reduced and checked on 100 and 144&lt;br&gt;
&amp;gt; &amp;gt; output=54&lt;br&gt;
&amp;gt; &amp;gt; Hidden layer = 20 but checked on 30,40,50,60,70,80,90,100 upto 250&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; Sample size i tried to train th net are&lt;br&gt;
&amp;gt; &amp;gt; 5400   (i.e. 100*54=5400) but also checked on&lt;br&gt;
&amp;gt; &amp;gt; 540    (i.e. 10*54=540) and&lt;br&gt;
&amp;gt; &amp;gt; 1080   (i.e. 20*54=1080) and&lt;br&gt;
&amp;gt; &amp;gt; 1350   (i.e. 25*54=1350) and&lt;br&gt;
&amp;gt; &amp;gt; 2700   (i.e. 50*54=2700)&lt;br&gt;
&amp;gt; &amp;gt; where 54 are the number of character and 100,10,20,25 and 50 are samples of each character&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; So you have&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; size(p) = [400 Ntrn] for a character with 20*20 = 400 pixels&lt;br&gt;
&amp;gt; size(t)  = [54 Ntrn] for 54 letters, integers and special characters?&lt;br&gt;
&lt;br&gt;
yes i have 400 Ntrn and 54 letter...all urdu character special character not considered.&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&amp;gt; How similar are testing and training sets?&lt;br&gt;
testing and training data are sample from  the same population&lt;br&gt;
&amp;gt; Clustering and visualizing the data should help.&lt;br&gt;
kindly help or reference on clustering......&lt;br&gt;
&lt;br&gt;
&amp;gt; if Q ~= Qa, error, end&lt;br&gt;
Yes Q=Qa&lt;br&gt;
&amp;gt; &amp;gt; % DEFINING THE NETWORK&lt;br&gt;
&lt;br&gt;
&amp;gt; Why not standardize inputs and use tansig hidden nodes??&lt;br&gt;
i have checked both and now ammeded the first to tansig and left the 2nd as it was as i need that to compare with ascii.&lt;br&gt;
&lt;br&gt;
&amp;gt; H = S1?&lt;br&gt;
yes it is .&lt;br&gt;
&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; netn.trainParam.goal =0.01;% mean(var(Target))/100; %0.009;%mean(var(Target))/100; % Mean-squared error goal.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Revisit this.&lt;br&gt;
&lt;br&gt;
i am using this as suggested by you.&lt;br&gt;
&lt;br&gt;
&amp;gt; Use only one noise level and scale it to the&lt;br&gt;
&amp;gt; standard deviation of Alphabet in order to get&lt;br&gt;
&amp;gt; a specified SNR.&lt;br&gt;
i dont understand or say dont know how to do....&lt;br&gt;
&lt;br&gt;
&amp;gt; You can also replace forced classification (always&lt;br&gt;
&amp;gt; make a classification) with conditional classification&lt;br&gt;
&amp;gt; (only make a classification if the posterior estimate&lt;br&gt;
&amp;gt; is larger than a threshold). To do this, overlay the&lt;br&gt;
&amp;gt; color coded histograms of the output for the classes&lt;br&gt;
&amp;gt; that get the most confused.&lt;br&gt;
kindly elaborate this a little, assume i am a novice.&lt;br&gt;
and also  how to calculate error....&lt;br&gt;
&lt;br&gt;
this is my 2nd thread on the same question as i was not receiving reply for a long time on my thread  &lt;br&gt;
&lt;a href=&quot;http://www.mathworks.com/matlabcentral/newsreader/view_thread/235521#614583&quot;&gt;http://www.mathworks.com/matlabcentral/newsreader/view_thread/235521#614583&lt;/a&gt;&lt;br&gt;
so its better to discuss the problem in a single place so i will ask questions on that ( old ) thread here..&lt;br&gt;
in that thread you suggested that :&lt;br&gt;
&lt;br&gt;
&amp;gt;Maybe your classes are not well defined&lt;br&gt;
&amp;gt;and have to be partitioned into subclasses&lt;br&gt;
&amp;gt;via clustering (e.g., k-means).&lt;br&gt;
how to perform this process ( k means )?&lt;br&gt;
&lt;br&gt;
&amp;gt;Overlay the plot of each misclassified character&lt;br&gt;
&amp;gt;(blue) on the plot of the mean of the class to&lt;br&gt;
&amp;gt;which they were assigned (red) and the plot of&lt;br&gt;
&amp;gt;the mean of the correct class (black)clustering.&lt;br&gt;
&amp;gt;This should give some insight into the difficulty.&lt;br&gt;
kindly help on this too.....&lt;br&gt;
&lt;br&gt;
i have changed the code and included validation and testing ...it gets converged when i use H=2000 but the validation and testing line ( on graph ) remain well above the goal line and results are about 15-20 %.&lt;br&gt;
the code now goes as below:&lt;br&gt;
&lt;br&gt;
Alphabet =Alpha4Train;&lt;br&gt;
Target=TargetSet;&lt;br&gt;
[S1,Qa] = size(Alphabet);  %% s=315 and Qa=54000 as now i  have resized characters to 21x15&lt;br&gt;
[S2,Q] =size(Target);%% S2=11 and Q=5400  which means Q=Qa&lt;br&gt;
% DEFINING THE NETWORK&lt;br&gt;
% ====================&lt;br&gt;
H1 =2000;  %% chosen using trial ...&lt;br&gt;
net = newff(minmax(Alphabet),[H1 S2],{'tansig' 'logsig'},'trainscg');&lt;br&gt;
net.performFcn = 'mse'; &lt;br&gt;
net.trainParam.goal = mean(var(Target))/100;%% as suggested by Greg Heath&lt;br&gt;
net.trainParam.show = 10; &lt;br&gt;
net.trainParam.epochs = 500; &lt;br&gt;
% TRAINING THE NETWORK &lt;br&gt;
% ====================&lt;br&gt;
testPercent = 0.25;  &lt;br&gt;
validatePercent = 0.25; &lt;br&gt;
[trainSamples,validateSamples,testSamples] = dividevec(Alphabet,Target,testPercent,validatePercent);&lt;br&gt;
[net,tr] = train(net,trainSamples.P,trainSamples.T,[],[],validateSamples,testSamples);&lt;br&gt;
&lt;br&gt;
i know that number of questions are increasing to be answered at one time but ...hope no one will mind....&lt;br&gt;
thanks in advance for your time...&lt;br&gt;
Zaheer Ahmad...</description>
    </item>
    <item>
      <pubDate>Wed, 10 Dec 2008 21:25:04 -0500</pubDate>
      <title>Re: MLP Optimization Problem ( generalization problem ) -- on OCR</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/240079#616273</link>
      <author>zaheer ahmad</author>
      <description>well, how to train the network using different input sized matrix i.e. i want to first  train the network on 21x15 input matrix then want to train ( re-train ) the same network on 16x10 input matrix. The purpose of the process is to get a network which will be able to recognize different size of  characters.....&lt;br&gt;
I tried directly to pass new input matrix to 'train' but it produced error ( as i was expecting ).&lt;br&gt;
one technique might be to pass it the weights and bias returned from the first training session but there will be a mismatch in the number of weights and bias because of change in number of input in input layer.... and i just got why the function 'train' trained on input size-1 matrix cant be trained directly on size-2 input matix....its because of number of weights too...am i correct?....then what can i do...how to retrain a network on differently sized input matrices...&lt;br&gt;
thanks in advance&lt;br&gt;
zaheer ahmad</description>
    </item>
    <item>
      <pubDate>Wed, 17 Dec 2008 17:25:01 -0500</pubDate>
      <title>Re: MLP Optimization Problem ( generalization problem ) -- on OCR</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/240079#617632</link>
      <author>Greg Heath</author>
      <description>On Dec 6, 3:54 pm, &quot;zaheer ahmad&quot; &amp;lt;ahmad.zah...@yah00000.com&amp;gt; wrote:&lt;br&gt;
&amp;gt; Greg Heath&amp;lt;he...@alumni.brown.edu&amp;gt; wrote in message &amp;lt;e9dc5bcb-cf3d-4a6f-9fdd-d4ea0b8ee...@d23g2000yqc.googlegroups.com&amp;gt;...&lt;br&gt;
&amp;gt; &amp;gt; On Nov 28, 12:45 pm, &quot;zaheer ahmad&quot; &amp;lt;ahmad.zah...@yah00000.com&amp;gt; wrote:&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; Dear All&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; I am developing an OCR (Urdu) but having 'goal doesnt meet' problem.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; my network is&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; Input =400 also reduced and checked on 100 and 144&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; output=54&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; Hidden layer = 20 but checked on 30,40,50,60,70,80,90,100 upto 250&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; Sample size i tried to train th net are&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; 5400   (i.e. 100*54=5400) but also checked on&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; 540    (i.e. 10*54=540) and&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; 1080   (i.e. 20*54=1080) and&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; 1350   (i.e. 25*54=1350) and&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; 2700   (i.e. 50*54=2700)&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; where 54 are the number of character and 100,10,20,25 and 50 are samples of each character&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; So you have&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; size(p) = [400 Ntrn] for a character with 20*20 = 400 pixels&lt;br&gt;
&amp;gt; &amp;gt; size(t)  = [54 Ntrn] for 54 letters, integers and special characters?&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; yes i have 400 Ntrn and 54 letter...all urdu character special character not considered.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; How similar are testing and training sets?&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; testing and training data are sample from  the same population&lt;br&gt;
&amp;gt; &amp;gt; Clustering and visualizing the data should help.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; kindly help or reference on clustering......&lt;br&gt;
&lt;br&gt;
Search on the matlab website. Iwould use kmeans.&lt;br&gt;
&lt;br&gt;
&amp;gt; &amp;gt; if Q ~= Qa, error, end&lt;br&gt;
&amp;gt; Yes Q=Qa&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; % DEFINING THE NETWORK&lt;br&gt;
&amp;gt; &amp;gt; Why not standardize inputs and use tansig hidden nodes??&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; i have checked both and now ammeded the first to tansig and left the 2nd as it was as i need that to compare with ascii.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; H = S1?&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; yes it is .&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; netn.trainParam.goal =0.01;% mean(var(Target))/100; %0.009;%mean(var(Target))/100; % Mean-squared error goal.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; Revisit this.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; i am using this as suggested by you.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; Use only one noise level and scale it to the&lt;br&gt;
&amp;gt; &amp;gt; standard deviation of Alphabet in order to get&lt;br&gt;
&amp;gt; &amp;gt; a specified SNR.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; i dont understand or say dont know how to do....&lt;br&gt;
&lt;br&gt;
x       = x0 + noise&lt;br&gt;
SNR = mean(x0^2)/mean(noise^2)&lt;br&gt;
&lt;br&gt;
Assuming&lt;br&gt;
&lt;br&gt;
mean(randn(size(x))^2) ~ 1&lt;br&gt;
mean(x0*randn(size(x)) ~ 0&lt;br&gt;
&lt;br&gt;
choose&lt;br&gt;
&lt;br&gt;
x = x0 + sqrt(mean(x0^2)/SNR)*randn(size(x));&lt;br&gt;
&lt;br&gt;
&amp;gt; &amp;gt; You can also replace forced classification (always&lt;br&gt;
&amp;gt; &amp;gt; make a classification) with conditional classification&lt;br&gt;
&amp;gt; &amp;gt; (only make a classification if the posterior estimate&lt;br&gt;
&amp;gt; &amp;gt; is larger than a threshold). To do this, overlay the&lt;br&gt;
&amp;gt; &amp;gt; color coded histograms of the output for the classes&lt;br&gt;
&amp;gt; &amp;gt; that get the most confused.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; kindly elaborate this a little, assume i am a novice.&lt;br&gt;
&amp;gt; and also  how to calculate error....&lt;br&gt;
&lt;br&gt;
Sorry, I don't have the time.&lt;br&gt;
&lt;br&gt;
Try searching the Google Group archives for&lt;br&gt;
&lt;br&gt;
greg-heath forced-classification&lt;br&gt;
greg-heath conditional-classification&lt;br&gt;
&lt;br&gt;
&amp;gt; this is my 2nd thread on the same question as i was not receiving reply for a long time on my thread  &lt;a href=&quot;http://www.mathworks.com/matlabcentral/newsreader/view_thread/235521#...&quot;&gt;http://www.mathworks.com/matlabcentral/newsreader/view_thread/235521#...&lt;/a&gt;&lt;br&gt;
&amp;gt; so its better to discuss the problem in a single place so i will ask questions on that ( old ) thread here..&lt;br&gt;
&amp;gt; in that thread you suggested that :&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt;Maybe your classes are not well defined&lt;br&gt;
&amp;gt; &amp;gt;and have to be partitioned into subclasses&lt;br&gt;
&amp;gt; &amp;gt;via clustering (e.g., k-means).&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; how to perform this process ( k means )?&lt;br&gt;
&lt;br&gt;
See the mathworks website documentation&lt;br&gt;
for clustering finctions.&lt;br&gt;
&lt;br&gt;
&amp;gt; &amp;gt;Overlay the plot of each misclassified character&lt;br&gt;
&amp;gt; &amp;gt;(blue) on the plot of the mean of the class to&lt;br&gt;
&amp;gt; &amp;gt;which they were assigned (red) and the plot of&lt;br&gt;
&amp;gt; &amp;gt;the mean of the correct class (black)clustering.&lt;br&gt;
&amp;gt; &amp;gt;This should give some insight into the difficulty.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; kindly help on this too.....&lt;br&gt;
&lt;br&gt;
The mean of the members of each class should be&lt;br&gt;
a very recognizable template representing the class.&lt;br&gt;
If it is not, you should try to partition the class into&lt;br&gt;
subclasses.&lt;br&gt;
&lt;br&gt;
&amp;gt; i have changed the code and included validation and testing ...it gets converged when i use H=2000 but the validation and testing line ( on graph ) remain well above the goal line and results are about 15-20 %.&lt;br&gt;
&lt;br&gt;
What error rate would you be satisfied with?&lt;br&gt;
&lt;br&gt;
&amp;gt; the code now goes as below:&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Alphabet =Alpha4Train;&lt;br&gt;
&amp;gt; Target=TargetSet;&lt;br&gt;
&amp;gt; [S1,Qa] = size(Alphabet);  %% s=315 and Qa=54000 as now i  have resized characters to 21x15&lt;br&gt;
&amp;gt; [S2,Q] =size(Target);%% S2=11 and Q=5400  which means Q=Qa&lt;br&gt;
&amp;gt; % DEFINING THE NETWORK&lt;br&gt;
&amp;gt; % ====================&lt;br&gt;
&amp;gt; H1 =2000;  %% chosen using trial ...&lt;br&gt;
&amp;gt; net = newff(minmax(Alphabet),[H1 S2],{'tansig' 'logsig'},'trainscg');&lt;br&gt;
&amp;gt; net.performFcn = 'mse';&lt;br&gt;
&amp;gt; net.trainParam.goal = mean(var(Target))/100;%% as suggested byGreg Heath&lt;br&gt;
&amp;gt; net.trainParam.show = 10;&lt;br&gt;
&amp;gt; net.trainParam.epochs = 500;&lt;br&gt;
&amp;gt; % TRAINING THE NETWORK&lt;br&gt;
&amp;gt; % ====================&lt;br&gt;
&amp;gt; testPercent = 0.25;&lt;br&gt;
&amp;gt; validatePercent = 0.25;&lt;br&gt;
&lt;br&gt;
These percentages may be too high.&lt;br&gt;
&lt;br&gt;
&amp;gt; [trainSamples,validateSamples,testSamples] = dividevec(Alphabet,Target,testPercent,validatePercent);&lt;br&gt;
&amp;gt; [net,tr] = train(net,trainSamples.P,trainSamples.T,[],[],validateSamples,testSamples);&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; i know that number of questions are increasing to be answered at one time but ...hope no one will mind....&lt;br&gt;
&amp;gt; thanks in advance for your time...&lt;br&gt;
&lt;br&gt;
Try multiple trials of 10-fold cross-validation (XVAL).&lt;br&gt;
keep track of the standard deviation as well as the mean.&lt;br&gt;
&lt;br&gt;
greg-heath XVAL&lt;br&gt;
greg-heath cross-validation&lt;br&gt;
&lt;br&gt;
Hope this helps.&lt;br&gt;
&lt;br&gt;
Greg</description>
    </item>
    <item>
      <pubDate>Wed, 17 Dec 2008 17:33:05 -0500</pubDate>
      <title>Re: MLP Optimization Problem ( generalization problem ) -- on OCR</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/240079#617633</link>
      <author>Greg Heath</author>
      <description>On Dec 10, 4:25=A0pm, &quot;zaheer ahmad&quot; &amp;lt;ahmad.zah...@yah00000.com&amp;gt; wrote:&lt;br&gt;
&amp;gt; well, how to train the network using different input sized matrix i.e. i =&lt;br&gt;
want to first =A0train the network on 21x15 input matrix then want to train=&lt;br&gt;
&amp;nbsp;( re-train ) the same network on 16x10 input matrix. The purpose of the pr=&lt;br&gt;
ocess is to get a network which will be able to recognize different size of=&lt;br&gt;
&amp;nbsp;=A0characters.....&lt;br&gt;
&lt;br&gt;
All images have to be the same size. You can try&lt;br&gt;
embedding the smaller sized image into the larger&lt;br&gt;
frame. However, you may need to use scale-invariant&lt;br&gt;
classification.&lt;br&gt;
&lt;br&gt;
The only method I know of (and have never used) is&lt;br&gt;
to use Fourier coefficients as inputs.&lt;br&gt;
&lt;br&gt;
You need to search for scale-invariant image&lt;br&gt;
classification.&lt;br&gt;
&lt;br&gt;
Hope this helps.&lt;br&gt;
&lt;br&gt;
Greg&lt;br&gt;
&lt;br&gt;
-----SNIP</description>
    </item>
    <item>
      <pubDate>Sun, 21 Dec 2008 09:13:04 -0500</pubDate>
      <title>Re: MLP Optimization Problem ( generalization problem ) -- on OCR</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/240079#618239</link>
      <author>zaheer ahmad</author>
      <description>Thanks Alot Mr.Greg Heath thanks alot for your help  and time...I got my solution and trained the net..&lt;br&gt;
I was having problem in my targets and goal...&lt;br&gt;
there were some rows ( fully filled with zeros )  in the target array, and the goal I set was not good..now i have set my goal=0.0001 and removed zeros from target set. despite that it doesn't achieve this goal (0.0001 ) but the results are very promising and my results improved very well. i think it will achieve this goal but i get bored and frustrated after waiting for 4-5 hours processing ans stop the training  or my system restarts( being overloaded ). but when i check the results it remains good. so my problem solved,thanks again as&lt;br&gt;
Your suggestions and recommendations help me alot to improve my coding and knowledge in neural networks.&lt;br&gt;
Being a novice in NN i was unable to understand what is the actual problem and how to review the whole neural network routines..but your suggestion posted here and in response of other questions which i have thoroughly studies help me alot.&lt;br&gt;
Zaheer Ahmad&lt;br&gt;
Institute of Management Science(IMSciences)&lt;br&gt;
Peshawar Pakistan.</description>
    </item>
    <item>
      <pubDate>Tue, 10 Feb 2009 11:33:01 -0500</pubDate>
      <title>Re: MLP Optimization Problem ( generalization problem ) -- on OCR</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/240079#627298</link>
      <author>manjula reddy</author>
      <description>Greg Heath &amp;lt;heath@alumni.brown.edu&amp;gt; wrote in message &amp;lt;e9dc5bcb-cf3d-4a6f-9fdd-d4ea0b8ee6a9@d23g2000yqc.googlegroups.com&amp;gt;...&lt;br&gt;
&amp;gt; On Nov 28, 12:45 pm, &quot;zaheer ahmad&quot; &amp;lt;ahmad.zah...@yah00000.com&amp;gt; wrote:&lt;br&gt;
&amp;gt; &amp;gt; Dear All&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; I am developing an OCR (Urdu) but having 'goal doesnt meet' problem.&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; my network is&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; Input =400 also reduced and checked on 100 and 144&lt;br&gt;
&amp;gt; &amp;gt; output=54&lt;br&gt;
&amp;gt; &amp;gt; Hidden layer = 20 but checked on 30,40,50,60,70,80,90,100 upto 250&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; Sample size i tried to train th net are&lt;br&gt;
&amp;gt; &amp;gt; 5400   (i.e. 100*54=5400) but also checked on&lt;br&gt;
&amp;gt; &amp;gt; 540    (i.e. 10*54=540) and&lt;br&gt;
&amp;gt; &amp;gt; 1080   (i.e. 20*54=1080) and&lt;br&gt;
&amp;gt; &amp;gt; 1350   (i.e. 25*54=1350) and&lt;br&gt;
&amp;gt; &amp;gt; 2700   (i.e. 50*54=2700)&lt;br&gt;
&amp;gt; &amp;gt; where 54 are the number of character and 100,10,20,25 and 50 are samples of each character&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; So you have&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; size(p) = [400 Ntrn] for a character with 20*20 = 400 pixels&lt;br&gt;
&amp;gt; size(t)  = [54 Ntrn] for 54 letters, integers and special characters?&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; i tried on using traingdx, trainlm and trainscg( because of out of memory error ) with both   mse and sse.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Forget sse&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; i dont know why it doesnt reach to the gaol the goal=0.1 for traingdx (or goal= 0.009 for tranlm)&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Why the difference? How were the goals determined?&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; some time it reach to goal but doesnt recognise test data.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; How similar are testing and training sets?&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Clustering and visualizing the data should help.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; the code is given as below:&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; clear;clc;&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; % SET CHARACTERS:&lt;br&gt;
&amp;gt; &amp;gt; Alphabet =Alpha4Train;%Alphabet =Alphabet(:,1:100);&lt;br&gt;
&amp;gt; &amp;gt; Target=TargetSet;%Target=Target(1:100);&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; ??&lt;br&gt;
&amp;gt; 5400 not 100&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; [S1,Qa] = size(Alphabet);&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; [400 5400]&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; [S2,Q] =size(Target);&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; [54 5400]&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; if Q ~= Qa, error, end&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; % DEFINING THE NETWORK&lt;br&gt;
&amp;gt; &amp;gt; % ====================&lt;br&gt;
&amp;gt; &amp;gt; H1 =120 ;%115=10  120=0 with mc=0.5   120=2...80....200=met for 10 char ...150     120  for 10 alphas&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; I have no idea what the comment is supposed to mean.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Nw = (400+1)*120+(120+1)*54 = 54+(1+400+54)*120 = 54,654&lt;br&gt;
&amp;gt; Neq = 5400*54 = 291,600 ~ 5.3*Nw&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Would have prefered a higher ratio.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; net =newff(minmax(Alphabet),[H1 S2],{'logsig' 'logsig'},'traingdx');%trainrp  trainscg&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Why not standardize inputs and use tansig hidden nodes??&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; %%%%traingdx  traingdm  trainlm traincgf,   net =newff(minmax(alphabet),[S1 S2],{'logsig' 'logsig'},'traingdx');&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; net.performFcn = 'sse'; % sse   Sum-Squared Error performance function&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Why not use mse??&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; net.trainParam.goal =0.10;% mean(var(Target))/100; %0.10;% 0.009;% Sum-squared error goal.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; ??&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; c = 54&lt;br&gt;
&amp;gt; mean(Target) = [ 1 + (c-1)*0]/c = 1/c = 1/54 = 1.85e-2&lt;br&gt;
&amp;gt; mean(var(Target)) = [(1-1/c)^2 + (c-1)*(0-1/c)^2]/(c-1) = 1/c&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; net.trainParam.goal  = 1.85e-4     % MSE&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; net.trainParam.show = 10; % Frequency of progress displays (in epochs).&lt;br&gt;
&amp;gt; &amp;gt; net.trainParam.epochs = 95000; %5000 Maximum number of epochs to train.&lt;br&gt;
&amp;gt; &amp;gt; %  net.trainParam.mc = 0.95;%0.65;% % Momentum constant.  mc=0.65 and s1=100 good memorization&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; H = S1?&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; %  net.trainParam.mem_reduc =99999;&lt;br&gt;
&amp;gt; &amp;gt; % net.trainParam.lr=0.01;%Learning rate&lt;br&gt;
&amp;gt; &amp;gt; % net.trainParam.lr_inc=1.9;&lt;br&gt;
&amp;gt; &amp;gt; % net.trainParam.lr_dec = 0.5;&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; I use trainlm or trainscg and only specify goal,&lt;br&gt;
&amp;gt; show and (rarely) epochs.&lt;br&gt;
&amp;gt; So, I can't comment on the other settings.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; % TRAINING THE NETWORK&lt;br&gt;
&amp;gt; &amp;gt; % ====================&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; P = [Alphabet,Alphabet,Alphabet,Alphabet,Alphabet,Alphabet,Alphabet];&lt;br&gt;
&amp;gt; &amp;gt; T = [Target,Target,Target,Target,Target,Target,Target];&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; This doesn't make sense.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; [net,tr] = train(net,P,T);&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; % TRAINING THE NETWORK WITH NOISE...GET DIRTY FOR GOOD RESULTS AT THE END&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; This is called Jittering. Go to Google groups and search on&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; greg-heath jittering&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; % =======================================================================&lt;br&gt;
&amp;gt; &amp;gt; netn = net;&lt;br&gt;
&amp;gt; &amp;gt; netn.trainParam.goal =0.01;% mean(var(Target))/100; %0.009;%mean(var(Target))/100; % Mean-squared error goal.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Revisit this.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; netn.trainParam.epochs = 85000;%500&lt;br&gt;
&amp;gt; &amp;gt; netn.trainParam.show = 10; %%% Frequency of progress displays (in epochs).&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; T = [Target,Target,Target,Target,Target,Target,Target];&lt;br&gt;
&amp;gt; &amp;gt; P = [(Alphabet + randn(S1,Qa)*0.2), Alphabet + randn(S1,Qa)*0.3, Alphabet + &amp;gt; randn(S1,Qa)*0.3,Alphabet,Alphabet,&lt;br&gt;
&amp;gt; &amp;gt; (Alphabet + randn(S1,Qa)*0.2), Alphabet + randn(S1,Qa)*0.3];&lt;br&gt;
&amp;gt; &amp;gt; [netn,trn] = train(netn,Alphabet,Target);&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Since Neq/Nw ~ 5. Probably don't need to increase Ntrn&lt;br&gt;
&amp;gt; by more than a factor of 2 to 4.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Use only one noise level and scale it to the&lt;br&gt;
&amp;gt; standard deviation of Alphabet in order to get&lt;br&gt;
&amp;gt; a specified SNR.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; %   load netxxx1010; ImProc(netn,net);&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; save netgdx2115;&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; %%%%%%%%%%&lt;br&gt;
&amp;gt; &amp;gt; i have only 100 samples for each character to i have used&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; P = [Alphabet,Alphabet,Alphabet,Alphabet,Alphabet,Alphabet,Alphabet];&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; to the get inequality&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; Neq &amp;gt;~ r* Nw       where (~2 &amp;lt; r &amp;lt; ~ 64).    as described by Greg Heath in posts.&lt;br&gt;
&amp;gt; &amp;gt; so it doesnt need to tell that i have tried to follow Greg Heath rule rule for choosing hidden layer.&lt;br&gt;
&amp;gt; &amp;gt; even tried to overrule it some times but all in vain.&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; the comments in the code shows the values i have tested, so i have not omitted the comments for yours&lt;br&gt;
&amp;gt; &amp;gt; reading despite it make the code reading a bit difficult, hope no one will mind.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; You should overlay plots of misclassified characters&lt;br&gt;
&amp;gt; with plots of means of the correct and assigned classes.&lt;br&gt;
&amp;gt; Perhaps the classes are not defined well enough and&lt;br&gt;
&amp;gt; you may need to use clustering to create well defined&lt;br&gt;
&amp;gt; subclasses.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; You can also replace forced classification (always&lt;br&gt;
&amp;gt; make a classification) with conditional classification&lt;br&gt;
&amp;gt; (only make a classification if the posterior estimate&lt;br&gt;
&amp;gt; is larger than a threshold). To do this, overlay the&lt;br&gt;
&amp;gt; color coded histograms of the output for the classes&lt;br&gt;
&amp;gt; that get the most confused.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Go to Google Groups and search on&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; greg-heath forced-classification&lt;br&gt;
&amp;gt; greg-heath conditional-classification&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Hope this helps.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Greg</description>
    </item>
  </channel>
</rss>

