Prev: plot output from two for-loops in log-log scale
Next: How to save the imwrite result image in a variable
From: Dalmar on 4 Jun 2010 14:47 I have written this NN to classify different cases. Simulation is excellent but I could not get the required target T during the testing. Please let me know your suggestion. I am desperate to solve this problem due to submission of my postgraduate final year. P: input data; T: targets, P2a: testing input data; t2: testing targets Regards This is the Matlab code Inline Attachment Follows: matrixdatatraining2.m %% Neural Network Classification % training Matrix data load P0;load P1;load P2;load P3;load P4; % training data (Inputs) size(Pi=909x3) [r0 c0] = size(P0); [r1 c1] = size(P1); [r2 c2] = size(P2); [r3 c3] = size(P3); [r4 c4] = size(P4); TARGET: t0=zeros(r0,1); t1=ones(r1,1)*-2; t2=ones(r2,1)*2 ;t3=ones(r3,1)*-5; t4=ones(r4,1)*5; %% Taking Input training data P=[P0; P1; P2; P3; P4]; T = [zeros(r0,1); ones(r1,1)*-2; ones(r2,1)*2 ;ones(r3,1)*-5; ones(r4,1)*5]; %(Targets) P = transpose(P); T = transpose(T); testing data load P2a;%load P2a;load P3a;load P4a; % Testing data size(Pi=909x3) [Pn,minp,maxp,Tn,mint,maxt]=premnmx(P,T); [an,mina,maxa,sn,mins,maxs]=premnmx(P2a',t2');% normalization %% Creating and training of the Neural Network .. net = newff(minmax(Pn),[8,12,8,1],{'tansig','purelin','tansig', 'purelin'},'trainbr');%'trainbfg');%trainbr', trainlm); net.trainParam.show = 100%inf; net.trainParam.goal = 1e-5; net.trainParam.lr = 0.01; net.trainparam.lr_inc = 1.05; net.trainparam.lr_dec = 0.7; net.trainparam.max_perfect_inc = 1.04; net.trainparam.mc = 0.9; net.trainparam.min_grad = 1e-10; net.trainParam.epochs = 500; [net,tr] = train(net,Pn,Tn); %% Save the Network save matrixdatatraining, net; %% simulatation ); y = sim(net,an); % un-ormalization %[a1] = postmnmx(y,mins,maxs); tt=postmnmx(y',mins,maxs); % if you like plot the output figure(1) plot(tt,'r') hold %Current plot held plot(t2) title('Comparison between actual targets and predictions') % [m,b,r] = postreg(a,T); %% Plotting the training %Here the network is simulated and its output plotted against % the targets. figure(2) plot(s') hold on plot(T', 'r') title('Comparison between actual targets and predictions') hold off xlabel('Epoches') Any idea?
From: Greg Heath on 4 Jun 2010 17:53
On Jun 4, 2:47 pm, Dalmar <ybul...(a)googlemail.com> wrote: > I have written this NN to classify different cases. Simulation is > excellent but I could not get the required target T during the > testing. > Please let me know your suggestion. I am desperate to solve this > problem due to submission of my postgraduate final year. > P: input data; T: targets, P2a: testing input data; t2: testing > targets > Regards > This is the Matlab code > Inline Attachment Follows: matrixdatatraining2.m -----SNIP> > Any idea? Yes. 1. Please do not post separately to multiple groups. 2. Use a multiple group send list on a single post. See my replies in comp.ai.neural-nets. Any future correspondence should be sent to both groups as I have done with this reply. Hope this helps. Greg |