How can i stop the neural network after just one iteration ?
    11 visualizzazioni (ultimi 30 giorni)
  
       Mostra commenti meno recenti
    
    Mariem Harmassi
      
 il 30 Ago 2012
  
    
    
    
    
    Commentato: Joakim Lindblad
      
 il 9 Mar 2018
            Hi i am a master student and i am developping a matlab code for evolutionary neural network so the training algorithm is done with a genetic algoritm and i dont need to train my neural network with any training function available ,that's why i set the epochs to 1 . This is the code
net=NEWFF(minmax(trainInput'),[hn,1],{'tansig','purelin'},'traingd');
net.trainParam.show = NaN;
net.trainParam.lr = 0.05;
net.trainParam.mc = 0.1;
net.trainParam.epochs = 1;
net.trainParam.goal = 1e-2;
[net,tr]=train(net,trainInput',trainOutput');
I need a function which can stop the neural network after just one iteration that s mean i don t want the neural network to calculate a new weights and ierates .Dis This partial code realize this ?
closeloop is it useful ?
1 Commento
  Joakim Lindblad
      
 il 9 Mar 2018
				Guess I'm not the only one ending up on this ancient question...
To stop after one iteration, use an output function which returns true:
'OutputFcn',@(varargin) true
This can be useful to do, e.g., after resuming from a checkpoint.
If you know how to stop after zero iterations, plz post.
Risposta accettata
  Greg Heath
      
      
 il 1 Set 2012
        
      Modificato: Greg Heath
      
      
 il 1 Set 2012
  
      To design an I-H-O feedforward multilayer perceptron (with H hidden nodes) using Ntrn input/target training pairs with dimensions I and O, respectively,
1. Create the input and target matrices Xtrn and Ttrn with dimensions
 [ I Ntrn ] = size(Xtrn) 
 [ O Ntrn [ = size(Ttrn)
2. Standardize ( help mapstd, help zscore) the columns to have zero mean and unit variance. The resulting matrices are xtrn and ttrn.
3. This data will generate
 Neq = Ntrn*O
training equations which will be used to obtain
 Nw = (I+1)*H+(H+1)*O
unknown weights (including H+O bias weights).
4. Although
 H <= Hub = (Neq-O)/(I+O+1)
insures that
 Neq >= Nw,
the stronger condition
 H << Hub
is preferred in order to mitigate noise, measurement error and insufficient sampling variety.
5. The weights and biases are typically stored in matrices IW, b1, LW and b2 with sizes
 [ H I ]   = size(IW) 
 [ H 1 ]  = size(b1) 
 [ O H ] = size(LW) 
 [ O 1 ] = size(b2).
6. For an arbitrary input x, the hidden node and output signals are given by
 h = tanh( IW * x + b1 ); 
 y = LW * h + b2;
7. When the input xtrn yields the output ytrn, the corresponding error is
 etrn = ttrn-ytrn;
8. The corresponding degree-of-freedom adjusted mean-square error is
 MSEtrna = sum( etrn(:).^2 ) / (Neq-Nw)
9. A reasonable design objective is to choose (H,IW,b1,LW,b2) to minimize MSEtrna.
10. I would use the genetic algorithm to find the weights given an integer value for H that satisfies H < Hub (or better yet, H << Hub).
11. Notice that no functions from the NN Toolbox are necessary.
Hope this helps.
Greg
0 Commenti
Più risposte (2)
  Greg Heath
      
      
 il 31 Ago 2012
        
      Modificato: Walter Roberson
      
      
 il 1 Set 2012
  
      >Hi i am a master student and i am developping a matlab code for evolutionary 
>neural network so the training algorithm is done with a genetic algoritm and i
>dont need to train my neural network with any training function available ,that's
>why i set the epochs to 1.
Since you are not going to use any of the Toolbox training functions, do not use the function train and don't initialize any of it's parameters
This is your code
 net=NEWFF(minmax(trainInput'),[hn,1], 'tansig','purelin'},'traingd');
Erroneously capitalized newff, omitted a left brace and initialized a training algorithm that won't be used.
If you are going to use a genetic algorithm you should not use TRAIN. Therefore, it makes no sense to initialize training parameters.
Once input and target matrices are normalized and edited, the only NNET TBX functions needed are net.IW, net.LW, net.b, sim and mse.
I recommend starting with a a general genetic algorithm outline. Then determine where the NN creation, weight updating and simulation commands should be placed.
It might be worthwhile to search online, including the archives of comp.ai.neural-nets and comp.soft-sys.matlab for sample code.
Hope this helps.
Greg
0 Commenti
  Mariem Harmassi
      
 il 1 Set 2012
        3 Commenti
  Greg Heath
      
      
 il 1 Set 2012
				You appear to be very confused. I suggest the following:
1. Try to duplicatethe results from demos and/or examples in the NN Toolbox. 2. Check out some of my posted code via the search words
heath newff close clear
Do not attempt a genetic solution until you understand these basics.
Hope this helps.
Greg
Vedere anche
Categorie
				Scopri di più su Deep Learning Toolbox in Help Center e File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


