Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Improving ANN results
Replies: 16   Last Post: Nov 13, 2013 9:10 AM

 Search Thread: Advanced Search

 Messages: [ Previous | Next ]
 chaudhry Posts: 26 Registered: 10/13/13
Re: Improving ANN results
Posted: Oct 17, 2013 8:49 AM
 Plain Text Reply

"Greg Heath" <heath@alumni.brown.edu> wrote in message <l3kj60\$mlt\$1@newscl01ah.mathworks.com>...
> "Greg Heath" <heath@alumni.brown.edu> wrote in message <l3khqr\$1fe\$1@newscl01ah.mathworks.com>...
> > "chaudhry " <bilal_zafar9@yahoo.com> wrote in message <l3ebuu\$evs\$1@newscl01ah.mathworks.com>...
> >

> > > How to improve ANN results by reducing error through hidden layer size, through MSE, or by using while loop?
> >
> > Your data is not a good learning example. (Small size, constant x(1,:), weak relationship between input and target )
> >
> > 1. Practice on MATLAB data (e.g., simplefit_dataset)

>
> close all, clear all, clc
> format short
>
> x = [31 9333 2000;31 9500 1500;31 9700 2300;31 9700 2320;...
> 31 9120 2230;31 9830 2420;31 9300 2900;31 9400 2500]'
> t = [35000;23000;3443;2343;1244;9483;4638;4739]'
> xnew = [31 9333 2000]'
>
> % [ x, t ] = simplefit_dataset; % Better learning example
>
> [ I N ] = size( x ) % [ 3 8 ]
> [ O N ] = size( t ) % [ 1 8 ]
>
> %Standardization?
> varx = var( x') % 1e5 * [ 0 0.585 1.63 ] %Huge
> vart = var( t ) % 1.47e8 % Ditto
>
> % Delete x(1,:) and standardize
>
> x = x(2:3,:); %Omit for simplefit_dataset
> zx = zscore(x',1)';
> zt = zscore(t',1)';
> MSE00 = var(t',1) % = 1 Reference MSE
> Ntst = round(0.15*N) % = 1 default
> Ntrials = max(10,30/Ntst) % 30
>
> % Use default No. of hidden nodes (10)
>
> net = fitnet;
>
> rng(0)
> for i=1:Ntrials
> net = configure(net,x,t);
> [net tr ] = train(net,x,t);
> R2trn(i,1) = 1 - tr.best_perf/MSE00;
> R2val(i,1) = 1 - tr.best_vperf/MSE00;
> R2tst(i,1) = 1 - tr.best_tperf/MSE00;
> end
> R2s = [ R2trn R2val R2tst ]
>
> minR2s = min(R2s) % -13.2021 -17.1237 -22.9422
> medR2s = median(R2s) % 0.7096 0.4177 0.1100
> meanR2s = mean(R2s) % -0.8757 -1.2760 -1.8358
> stdR2s = std(R2s) % 3.4060 3.9508 4.8567
> maxR2s = max(R2s) % 1.0000 1.0000 0.9965
> sortR2s = sort(R2s)
>
> % sortR2s = -13.2021 -17.1237 -22.9422
> % -10.4006 -9.8592 -8.5426
> % -4.5224 -6.3693 -6.8485
> % -4.1019 -5.0681 -6.5369
> % -3.7170 -3.6865 -5.7350
> % -2.0340 -2.4595 -5.0384
> % -1.7259 -2.4565 -4.0096
> % -1.3995 -1.6079 -3.6787
> % -1.2526 -1.6025 -0.5167
> % -0.2069 -1.0937 -0.3695
> % -0.1213 -0.6480 -0.2804
> % 0.1603 -0.2390 -0.2782
> % 0.4618 0.1275 -0.2124
> % 0.6146 0.1944 -0.1174
> % 0.6782 0.2760 0.0623
> % 0.7410 0.5594 0.1577
> % 0.9138 0.7007 0.2807
> % 0.9301 0.7012 0.3786
> % 0.9488 0.7098 0.4315
> % 0.9736 0.7654 0.4789
> % 0.9917 0.9362 0.4834
> % 0.9999 0.9819 0.6334
> % 1.0000 0.9890 0.7886
> % 1.0000 0.9957 0.8014
> % 1.0000 0.9982 0.8439
> % 1.0000 0.9996 0.9090
> % 1.0000 0.9996 0.9091
> % 1.0000 0.9997 0.9253
> % 1.0000 0.9998 0.9510
> % 1.0000 1.0000 0.9965
>
> % Note that only 2 of 30 designs have R2tst >= 0.95 !!!
>
> % In contrast, for the simplefit_data set (x(1,:) NOT deleted)
> %
> % Ntrials = 10
> % R2s = 1.0000 1.0000 1.0000
> % 1.0000 1.0000 1.0000
> % 1.0000 1.0000 1.0000
> % 1.0000 1.0000 1.0000
> % 1.0000 1.0000 1.0000
> % 1.0000 1.0000 1.0000
> % 1.0000 1.0000 1.0000
> % 1.0000 1.0000 1.0000
> % 1.0000 0.9997 1.0000
> % 1.0000 1.0000 0.9999
>
> Now try minimizing the number of hidden nodes for the simplefit example.
>
> Hope this helps.
>
> Greg

HI GREG THNX ALOT ....I HAVE FEW Questions regarding the above code MY QUESTIONS MAY SEEMS STUPID BECAUSE IAM BEGINNER . I HAVE database of around 80 cross 30 parameters.

1.SIR y u have chose Ntrials parameter for forloop for training purpose.....can v use for example
such that errors=targets-outputs
while errors~=0 ..........
train(net,x).................
some thing like that.....or
while mse~=0
train(net,x)
is it right or wrong i dont knw.......if wrong kindly tell me the reason

2. why sir u havent considered weights ,,biases..epochs...etc.. and learning rate value....trainlm is independent of lr BUT Y then how he make system learn...from example

3.sir y v standardize
4.kindly explain these lines

zx = zscore(x',1)';
> zt = zscore(t',1)';
> MSE00 = var(t',1) % = 1 Reference MSE
> Ntst = round(0.15*N) % = 1 default
> Ntrials = max(10,30/Ntst) % 30

R2trn(i,1) = 1 - tr.best_perf/MSE00;
> R2val(i,1) = 1 - tr.best_vperf/MSE00;
> R2tst(i,1) = 1 - tr.best_tperf/MSE00;

why v have found medians..means....etc

Date Subject Author
10/13/13 chaudhry
10/15/13 Greg Heath
10/15/13 Greg Heath
10/17/13 chaudhry
10/17/13 chaudhry
10/18/13 Greg Heath
10/17/13 chaudhry
10/17/13 chaudhry
10/23/13 chaudhry
10/23/13 chaudhry
10/23/13 chaudhry
10/25/13 Greg Heath
11/3/13 chaudhry
11/3/13 Greg Heath
11/6/13 Greg Heath
11/6/13 Greg Heath
11/13/13 chaudhry

© The Math Forum at NCTM 1994-2018. All Rights Reserved.