MATLAB: How can i stop the neural network after just one iteration

evolutionaryneural networktraining

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 ?

Best Answer

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