How can i stop the neural network after just one iteration ?
Ältere Kommentare anzeigen
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 Kommentar
Joakim Lindblad
am 9 Mär. 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.
Akzeptierte Antwort
Weitere Antworten (2)
Greg Heath
am 31 Aug. 2012
Bearbeitet: Walter Roberson
am 1 Sep. 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
Mariem Harmassi
am 1 Sep. 2012
0 Stimmen
3 Kommentare
Greg Heath
am 1 Sep. 2012
No.
Do not use TRAIN (capitals used for emphasis; use lower case in code).
Standardize inputs and targets (help ZSCORE or help MAPSTD)
After you generate the new population of weights (IW,LW and b), use SIM to get outputs y and objective function MSE (normalized mean-square-error if targets are standardized).
P.S. You erroneously posted your comment to my answer in a new answer. Please use the space provided for comments.
Mariem Harmassi
am 1 Sep. 2012
Bearbeitet: Walter Roberson
am 1 Sep. 2012
Greg Heath
am 1 Sep. 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
Kategorien
Mehr zu Deep Learning Toolbox finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!