NN validation and data partition
显示 更早的评论
- 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
采纳的回答
更多回答(3 个)
Greg Heath
2013-2-19
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
2013-2-19
0 个投票
3 个评论
Greg Heath
2013-2-19
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
2013-2-20
laplace laplace
2013-3-9
laplace laplace
2013-4-17
0 个投票
1 个评论
Greg Heath
2013-4-24
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.
类别
在 帮助中心 和 File Exchange 中查找有关 Deep Learning Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!