www.ShoppingPodder.com

Leading Computer Shopping,
News and information


Part of the Identityscape.com network...

getxfactor.com jmoodmusic.com smartbusinesschoices.com mintdepot.com lowfaresalways.com evangelicalview.com shoppingpodder.com soproudlywehail.com webnews.ws currenthumor.com

 

 

newff usage
   Shopping Podder - the Best of Computer Postings! Forum Index -> Computer Artificial Intelligence - Neural Nets  
View previous topic :: View next topic  
Author Message
Guest







PostPosted: Fri Nov 14, 2008 3:50 am    Post subject: newff usage Reply with quote

I am new to Matlab and would appricate any help. I am trying to use
neuralnetwork tool box to do some classification. I have have 3 input
values that have to be classified to 5 outputs. I am using the latest
neural network tool box and the newff API as quoted below.

net = newff(P,T,[S1 S2...S(N-l)],{TF1 TF2...TFNl},
BTF,BLF,PF,IPF,OPF,DDF)

%3 hidden layers with 3 neurons
net = newff(P,T,[3 3 3],{},'traingdm');
net = train(net,P,T);
A = sim(net, P);

I am setting the epoch as 1000 iterations.
I am using a P (3x500 matrix sample input) i.e. each column is a
sample input pattern.
T (5x500 matrix of expected output) where each column is corresponding
output for a sample input pattern. i give a 1 for the correct output
and 0 for the other 4 wrong outputs.

eg. considering an input pattern P = [ 10 ; 20 ; 30] T = [ 1; 0 ; 0;
0; 0]

Questions -

1. How to decide on number of hidden layers and is the representation
ok?

2. Each time i train the network, it classifies the output
differently. How do I set the weight for 5 layers and 3 neurons? i
feel the randomness of weight, bias is causing this. Also the trial,
validation and test samples selected are randomly selected and
different each time.

3. Are there anyother parameters that need to be configured?

4. The neural net is only able to classify the inputs to 2 output
classes the rest are classified wrongly. Please let me know the usual
approach as to which parameters weight/bias/hidden layers/number of
neurons need to be tweaked?
Back to top
Greg Heath
Guest






PostPosted: Fri Nov 14, 2008 4:04 pm    Post subject: Re: newff usage Reply with quote

On Nov 13, 10:50 pm, clando...@gmail.com wrote:
Quote:
I am new to Matlab and would appricate any help. I am trying to use
neuralnetwork tool box to do some classification. I have have 3 input
values that have to be classified to 5 outputs. I am using the latest
neural network tool box and the newff API as quoted below.

net = newff(P,T,[S1 S2...S(N-l)],{TF1 TF2...TFNl},
BTF,BLF,PF,IPF,OPF,DDF)

%3 hidden layers with 3 neurons
net = newff(P,T,[3 3 3],{},'traingdm');
net = train(net,P,T);
A = sim(net, P);

I am setting the epoch as 1000 iterations.
I am using a P (3x500 matrix sample input) i.e. each column is a
sample input pattern.
T (5x500 matrix of expected output) where each column is corresponding
output for a sample input pattern. i give a 1 for the correct output
and 0 for the other 4 wrong outputs.

eg. considering an input pattern P = [ 10 ; 20 ; 30] T = [ 1; 0 ; 0;
0; 0]

Questions -

1. How to decide on number of hidden layers and is the representation
ok?

2. Each time i train the network, it classifies the output
differently. How do I set the weight for 5 layers and 3 neurons? i
feel the randomness of weight, bias is causing this. Also the trial,
validation and test samples selected are randomly selected and
different each time.

3. Are there anyother parameters that need to be configured?

4. The neural net is only able to classify the inputs to 2 output
classes the rest are classified wrongly. Please let me know the usualOn Nov 13, 10:50 pm, clando...@gmail.com wrote:
I am new to Matlab and would appricate any help. I am trying to use
neuralnetwork tool box to do some classification. I have have 3 input
values that have to be classified to 5 outputs. I am using the latest
neural network tool box and the newff API as quoted below.

net = newff(P,T,[S1 S2...S(N-l)],{TF1 TF2...TFNl},
BTF,BLF,PF,IPF,OPF,DDF)

Documentation typo: Replace TFN1 with TFN

Quote:
%3 hidden layers with 3 neurons
net = newff(P,T,[3 3 3],{},'traingdm');

Use 1 hidden layer.
The number of hidden nodes, H, should be
determined by trial and error.
Start out using defaults.

net = newff(P,T,H);

Go to Google groups and search on

greg-heath pretraining-advice
greg-heath Neq Nw

Quote:
net = train(net,P,T);
A = sim(net, P);

I am setting the epoch as 1000 iterations.

Start out with the default. Increase
only if needed.

Quote:
I am using a P (3x500 matrix sample input) i.e. each column is a
sample input pattern.
T (5x500 matrix of expected output) where each column is corresponding
output for a sample input pattern. i give a 1 for the correct output
and 0 for the other 4 wrong outputs.

eg. considering an input pattern P = [ 10 ; 20 ; 30] T = [ 1; 0 ; 0;
0; 0]

Questions -

1. How to decide on number of hidden layers and is the representation
ok?

The representation is OK. Start with Hmin = [],1
and Hmax determined from Neq & Nw explained in my
above mentioned posts. Then find the final H within these
bounds. For example, use a binary search and the recursion
H = (Hmin + Hmax)/2.

Quote:
2. Each time i train the network, it classifies the output
differently.

That is not unusual. Plot mse vs H . For each value of H
you may need to run multiple trials. therefore you will get
a multivalued scatter plot. Don't freak out ... just look
at the trend of the minimum and median or average values.

Quote:
How do I set the weight for 5 layers and 3 neurons?

Initial weights are automatically set by newff.
Final weights are determined by train.

Quote:
feel the randomness of weight, bias is causing this. Also the trial,
validation and test samples selected are randomly selected and
different each time.

Welcome to statistical pattern recognition.

Quote:
3. Are there anyother parameters that need to be configured?

1. Show more detail for mse vs epoch.
2. Use a nonzero goal for mse. I generally use

net.train.Param.show = 10;
net.train.Param.goal = mean(var(T))/100;

Since mean(T(:,i)) = 1/5 and var(T(:,i) = (4*/25+16/25)/4 = 1/5,
this corresponds to an average output error of sqrt(0.002)
= 0.0447; i.e., [0.9553,0.0447*ones(1,4)] for [1 0 0 0 0]

Quote:
4. The neural net is only able to classify the inputs to 2 output
classes the rest are classified wrongly. Please let me know the usual
approach as to which parameters weight/bias/hidden layers/number of
neurons need to be tweaked?

If you have ~ 100 cases for each class, just use 1
hidden layer and vary H.

If the number of cases is severely unbalanced, you
need to compensate by adding copies of the under
represented classes to P and T.

Crossposted to comp.soft-sys.matlab

Hope this helps.

Greg

Quote:
approach as to which parameters weight/bias/hidden layers/number of
neurons need to be tweaked?
Back to top
Guest







PostPosted: Sat Nov 15, 2008 4:41 am    Post subject: Re: newff usage Reply with quote

On Nov 14, 11:04 am, Greg Heath <he...@alumni.brown.edu> wrote:
Quote:
On Nov 13, 10:50 pm, clando...@gmail.com wrote:



I am new to Matlab and would appricate any help. I am trying to use
neuralnetwork tool box to do some classification. I have have 3 input
values that have to be classified to 5 outputs. I am using the latest
neural network tool box and thenewffAPI as quoted below.

net =newff(P,T,[S1 S2...S(N-l)],{TF1 TF2...TFNl},
BTF,BLF,PF,IPF,OPF,DDF)

%3 hidden layers with 3 neurons
net =newff(P,T,[3 3 3],{},'traingdm');
net = train(net,P,T);
A = sim(net, P);

I am setting the epoch as 1000 iterations.
I am using a P (3x500 matrix sample input) i.e. each column is a
sample input pattern.
T (5x500 matrix of expected output) where each column is corresponding
output for a sample input pattern. i give a 1 for the correct output
and 0 for the other 4 wrong outputs.

eg. considering an input pattern P = [ 10 ; 20 ; 30] T = [ 1; 0 ; 0;
0; 0]

Questions -

1. How to decide on number of hidden layers and is the representation
ok?

2. Each time i train the network, it classifies the output
differently. How do I set the weight for 5 layers and 3 neurons? i
feel the randomness of weight, bias is causing this. Also the trial,
validation and test samples selected are randomly selected and
different each time.

3. Are there anyother parameters that need to be configured?

4. The neural net is only able to classify the inputs to 2 output
classes the rest are classified wrongly. Please let me know the usualOn Nov 13, 10:50 pm, clando...@gmail.com wrote:
I am new to Matlab and would appricate any help. I am trying to use
neuralnetwork tool box to do some classification. I have have 3 input
values that have to be classified to 5 outputs. I am using the latest
neural network tool box and thenewffAPI as quoted below.

net =newff(P,T,[S1 S2...S(N-l)],{TF1 TF2...TFNl},
BTF,BLF,PF,IPF,OPF,DDF)

Documentation typo: Replace TFN1 with TFN

%3 hidden layers with 3 neurons
net =newff(P,T,[3 3 3],{},'traingdm');

Use 1 hidden layer.
The number of hidden nodes, H, should be
determined by trial and error.
Start out using defaults.

net =newff(P,T,H);

Go to Google groups and search on

greg-heath pretraining-advice
greg-heath Neq Nw

net = train(net,P,T);
A = sim(net, P);

I am setting the epoch as 1000 iterations.

Start out with the default. Increase
only if needed.

I am using a P (3x500 matrix sample input) i.e. each column is a
sample input pattern.
T (5x500 matrix of expected output) where each column is corresponding
output for a sample input pattern. i give a 1 for the correct output
and 0 for the other 4 wrong outputs.

eg. considering an input pattern P = [ 10 ; 20 ; 30] T = [ 1; 0 ; 0;
0; 0]

Questions -

1. How to decide on number of hidden layers and is the representation
ok?

The representation is OK. Start with Hmin = [],1
and Hmax determined from Neq & Nw explained in my
above mentioned posts. Then find the final H within these
bounds. For example, use a binary search and the recursion
 H = (Hmin + Hmax)/2.

2. Each time i train the network, it classifies the output
differently.

That is not unusual. Plot mse vs H . For each value of H
you may need to run multiple trials. therefore you will get
a multivalued scatter plot. Don't freak out ... just look
at the trend of the minimum and median or average values.

How do I set the weight for 5 layers and 3 neurons?

Initial weights are automatically set bynewff.
Final weights are determined by train.

feel the randomness of weight, bias is causing this. Also the trial,
validation and test samples selected are randomly selected and
different each time.

Welcome to statistical pattern recognition.

3. Are there anyother parameters that need to be configured?

1. Show more detail for mse vs epoch.
2. Use a nonzero goal for mse.  I generally use

net.train.Param.show = 10;
net.train.Param.goal = mean(var(T))/100;

Since mean(T(:,i)) =  1/5 and var(T(:,i)  = (4*/25+16/25)/4 = 1/5,
this corresponds to an average output error of sqrt(0.002)
= 0.0447; i.e., [0.9553,0.0447*ones(1,4)] for [1 0 0 0 0]

4. The neural net is only able to classify the inputs to 2 output
classes the rest are classified wrongly. Please let me know the usual
approach as to which parameters weight/bias/hidden layers/number of
neurons need to be tweaked?

If you have ~ 100 cases for each class, just use 1
hidden layer and vary H.

If the number of cases is severely unbalanced, you
need to compensate by adding copies of the under
represented classes to P and T.

Crossposted to comp.soft-sys.matlab

Hope this helps.

Greg

approach as to which parameters weight/bias/hidden layers/number of
neurons need to be tweaked?

Thanks a lot Greg, I will try as advised.
Back to top
Display posts from previous:   
   Shopping Podder - the Best of Computer Postings! Forum Index -> Computer Artificial Intelligence - Neural Nets  
Page 1 of 1
All times are GMT

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum