clear all, close all, clc, plt=0;
tic
[ x, t ] = simpleclass_dataset;
[ I N ] = size(x)
[ O N ] = size(t)
Ntst = round(0.15*N)
Nval = Ntst
Ntrn = N-Nval-Ntst
Ntrneq = prod(size(t))
Hub = -1 + ceil( ( Ntrneq-O) / (I+O+1) )
% For a robust design desire Nw << Ntrneq. Therefore, if possible, choose H << Hub. The PATTERNNET default is H = 10. However, the smaller H, the more robust the design. Obtaining 110 designs ( 10 trials each for H = 0:10 shows that ANY OF THESE VALUES CAN YIELD EXCELLENT RESULTS PROVIDED THE RANDOM WEIGHT INITIALIZATION IS NOT TOO POOR. The complete result can be duplicated below by choosing Hmax = 10 with Ntrials = 10. However, the result below for Hmax = 0 with Ntrials = 4 is sufficient to illustrate the concept.
Hmin = 0
dH = 1
Hmax = 0
Ntrials = 4
rng(0)
j=0
for h = Hmin:dH:Hmax
j=j+1
if h==0
net = patternnet([]);;
Nw = (I+1)*O
else
patternnet(h);
Nw = (I+1)*h+(h+1)*O
end
for i = 1:Ntrials
s(i,j) = rng
net = configure(net,x,t);
[ net tr y ] = train(net,x,t);
tstind = tr.testInd;
ttst = t(:,tstind);
ytst = y(:,tstind);
plt=plt+1,figure(plt)
plotconfusion(ttst,ytst)
title([ ' TEST SET CONFUSION MATRIX. TRIAL = ', num2str(10*(j-1)+i )] )
hold off
plt=plt+1,figure(plt)
plotroc(ttst,ytst)
title([ ' TEST SET ROC. TRIAL = ', num2str(10*(j-1)+i )] )
hold off
end
end
toc
Hope this helps.
Thank you for formally accepting my answer
Greg
Best Answer