NN validation and data partition
Show older comments
- 1)i got 50 data i use 35 to train the network 15* to test
- 2)i take these 35 data and split them into 7 folds of 5 data each
- i=1,..,n=7 i pick an i(5 data) to test/validate and the rest (30 data) to train the network
- 3) so now i have created 8 networks: the original and onother 7 due to the data partition i made
- 3a)i wanna save these 7 networks and be able to manipulate them
- 3b)i want to take the orignal 15 data* and run them through the 7 networks as test/validate data
Accepted Answer
More Answers (3)
Greg Heath
on 19 Feb 2013
1 Choose candidate values for Hopt, the optimal No. of hidden nodes by using ALL of the data and looping over Ntrials candidates values for each H in Hmin:dH:Hmax.
Neq = N*O % No. of training equations
Nw = (I+1)*H+(H+1)*O % No.of unknowns (weights)
Ndof = Neq - Nw % No. of estimation degrees-of-freedom
MSE = SSE/Neq % Biased MSE estimate
MSEa = SSE/Ndof %Unbiased ("a"djusted) MSE estimate
Hub = -1 + ceil( (Neq-O)/(I+O+1)) % Ndof > 0 (Neq >Nw) upper bound
Choose Hmin,dH,Hmax <= Hub
numH = length(Hmin:dH:Hmax)
Ntrials = 10 % No.of weight initializations per H value
2. Use ALL of the data for training to choose Hopt from Ntrials*numH candidate nets
a. rng(0) % Initialize random number generator
b. Outer Loop over h = Hmin:dH:Hmax (j=1:numH)
c. Inner loop over i = 1:Ntrials % of weight initializations
d. net.divideFcn = 'dividetrain'
e. MSEgoal = 0.01*Ndof*MSE00a/Neq
f. net.trainParam.goal = MSEgoal;
g. net = fitnet(h);
h. [net tr] = train(net,x,t);
i. Nepochs(i,j)= tr.best_epoch
j. MSE = tr.best_perf
k. NMSE = MSE/MSE00
l. R2(i,j) = 1-NMSE % Biased
m. MSEa = Neq*MSE/Ndof
n. NMSEa = MSEa/MSE00a
o. R2a(i,j) = 1-NMSEa % Unbiased
3. Estimating Hopt
a.Tabulate Nepochs, R2, and R2a in 3 Ntrials-by-numH matrices.
b.Choose (i,j)_opt and Hopt from maximum of R2a.
c.Redesign netopt by reinitializing RNG and calling it repeatedly to get
the same initial state as the (i,j)_opt run.
NOTE: Can obtain (i,j)opt, Hopt and net_opt within the loop. However, perusing the 3 tabulations is enlightening.
laplace laplace
on 19 Feb 2013
0 votes
3 Comments
Greg Heath
on 19 Feb 2013
That makes no sense.
You said you had 50 data points.
What are the dimensions of your input and output matrices?
Why a target of zeros and ones? ... Are you designing a 2-class classifier?
Very puzzled.
laplace laplace
on 20 Feb 2013
laplace laplace
on 9 Mar 2013
laplace laplace
on 17 Apr 2013
0 votes
1 Comment
Greg Heath
on 24 Apr 2013
Sorry I didn't see this until now.
You said
data: inputs 1x4 columns; outputs 0 or 1
whereas your input matrix has dimensions 4x50 containing 4x1 vectors.
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!