need help in undestanding neural network codes

Hi, I am writing a code to create an artificial neural network with some input,hidden and output layers. I also need a convergence chart showing the MSE vs the iteration run . First look at this example and please explain some sentences to me: p = [0 1 2 3 4 5 6 7 8]; t = [0 0.84 0.91 0.14 -0.77 -0.96 -0.28 0.66 0.99]; netj1 = newff(p,t,10); netj1 = init(netj1); netj1.trainParam.show = 10; netj1.trainParam.epochs = 100; netj1.trainParam.goal = 1e-12; netj1 = train(netj1,p,t);
z=sim(netj1,p);
trainerror=t-z;
perf = mse(trainerror);
**********************************
question 1
what does * netj1.trainParam.show* mean?
question 2 Is netj1.trainParam.epochs = 100; maximum number of epochs?
question 3 netj1.trainParam.goal = 1e-12; why should a goal be determined? what value is more appropriate?
question 4 when i run this code a window pops up . in the window title it is written "Neural Network Training (nntraintool)". It has some data such as algorithms, progress, and so on. When i click on performance it shows MSE for test, train, and validation data. I can not understand where didi it choose the train, test and validation data? What should i do if i have an arbitrary set of data and i want 1/5 of them be test data and the rest train data? how can i have its plot for MSE versus run comparing train and test?
question 5 what does perf = mse(trainerror); really mean? where is perf used? in the plot maybe?
i'm sorry that my questios are too long and basic!
Thanks for reading it
:)

 Accepted Answer

close all, clear all, clc;
p = [0 1 2 3 4 5 6 7 8]; % 9 one-dimensional inputs
t = [0 0.84 0.91 0.14 -0.77 -0.96 -0.28 0.66 0.99]; % 9 one-dimensional outputs
rng(0) % Initialize the RNG so the run can be duplicated
netj1 = newff(p,t,10); % ( 10 hidden nodes are too many for only 9 points)
% netj1 = init(netj1); % Delete. Newff is self initializing
disp('SOME NEWFF DEFAULTS:')
dividefcn = netj1.divideFcn % dividerand (random division of trn/val/tst points)
datasplitratios =netj1.divideParam % trn/val/tst = 0.7/0.15/0.15
show = netj1.trainParam.show % Show training plot every 25 epochs
maxepochs = netj1.trainParam.epochs %1000 = maximum number of epochs
MSEgoal = netj1.trainParam.goal % 0 (Unrealistic for RW problems)
performancefunction = netj1.performFcn % 'mse'
netj1.trainParam.show = 10; % Show training plot every 10 epochs
netj1.trainParam.epochs = 100; % 100 (Unrealisticly low for RW problems)
netj1.trainParam.goal = 1e-12; % (Unrealisticly low for RW problems)
netj1.trainParam.goal = var(t')/100; % 5.4e-3 is More appropriate
% netj1 = train(netj1,p,t); % % z=sim(netj1,p); % % trainerror=t-z; % % perf = mse(trainerror);
[ netj1 , tr, z, trainerror ] = train(netj1, p, t ) % No semicolon for display
% Study all of the useful info in the 1st two outputs
perf = tr.perf(end) % The mse performance measure
normperf = perf/var(t') % 0.0089 < normalized mse goal = 0.01
% See the demo in the documentation for datadivision details
% doc nnet
% Neural Network Toolbox
% Getting Started
% Getting Started
% Fitting a function
% Using Command-Line Functions
Hope this helps
Thank you for formally accepting my answer
Greg

More Answers (0)

Categories

Find more on Deep Learning Toolbox in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!