Control the epochs while training a neural network
Afficher commentaires plus anciens
I am trying to train a BP neural network with the following codes. I mean to run the iterations for 1000 epochs. However, when the net.trainParam.goal = 0 is achieved, the training process will stop, which is much less than 1000.
How can I set some parameters so that I can train the neural network for 1000 times. I can to plot MSE VS. epoch.
Thanks!
%%%%%%%%%%%%%%%%%%%% clear all; close all; clc;
% Number of Inputs(n), Outputs(r) and neurons in hidden layer(m) n = 1; r = 1; m = 12; % Number of training values (epochs) epochs = 1000; % Input value range x_min = -1; x_max = 1; for k = 1:n x_train(k,:) = x_min + (x_max-x_min)* rand(epochs,1); end % Desired values for random vector x_train y_des = 2*x_train.^2 + 1;
net = feedforwardnet(m);
net.trainParam.epochs = 1000; % epoch net.trainParam.show = 10; % show frequency net.trainParam.goal = 0; % objective MSE
net = train(net, x_train, y_des);
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Deep Learning Toolbox dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!