Neural nw : Inputs and targets have different numbers of samples
Fix MATLAB neural network errors! Learn why your inputs and targets have different numbers of samples and how to align them for successful training. Get solutio
Fix MATLAB neural network errors! Learn why your inputs and targets have different numbers of samples and how to align them for successful training. Get solutio
% >> help newpr % load simpleclass_dataset % net = newpr(simpleclassInputs,simpleclassTargets,20); % net = train(net,simpleclassInputs,simpleclassTargets); % simpleclassOutputs = net(simpleclassInputs); close all, clear all, clc, plt = 0 [ x, t ] = simpleclass_dataset; [ I N ] = size(x) % [ 2 1000 ] [ O N ] = size(t) % [ 4 1000 ] trueclass = vec2ind(t); class1 = find(trueclass==1); class2 = find(trueclass==2); class3 = find(trueclass==3); class4 = find(trueclass==4); N1 = length(class1) % 243 N2 = length(class2) % 247 N3 = length(class3) % 233 N4 = length(class4) % 277 x1 = x(:,class1); x2 = x(:,class2); x3 = x(:,class3); x4 = x(:,class4); plt = plt + 1 hold on plot(x1(1,:),x1(2,:),'ko') plot(x2(1,:),x2(2,:),'bo') plot(x3(1,:),x3(2,:),'ro') plot(x4(1,:),x4(2,:),'go') Hub = -1+ceil( (0.7*N*O-O)/(I+O+1)) % 399 Hmax = 40 % Hmax << Hub dH = 4 % Design ~10 candidate nets Hmin = 2 % I know 0 and 1 are too small rng(0) % Allows duplicating the rsults j=0 for h=Hmin:dH:Hmax j = j+1 net = newpr(x,t,h); [ net tr y ] = train( net, x, t ); assignedclass = vec2ind(y); err = assignedclass~=trueclass; Nerr = sum(err); PctErr(j,1) = 100*Nerr/N; end h = (Hmin:dH:Hmax)'; PctErr = PctErr; results = [ h PctErr ]
Matlabsolutions.com provides guaranteed satisfaction with a
commitment to complete the work within time. Combined with our meticulous work ethics and extensive domain
experience, We are the ideal partner for all your homework/assignment needs. We pledge to provide 24*7 support
to dissolve all your academic doubts. We are composed of 300+ esteemed Matlab and other experts who have been
empanelled after extensive research and quality check.
Matlabsolutions.com provides undivided attention to each Matlab
assignment order with a methodical approach to solution. Our network span is not restricted to US, UK and Australia rather extends to countries like Singapore, Canada and UAE. Our Matlab assignment help services
include Image Processing Assignments, Electrical Engineering Assignments, Matlab homework help, Matlab Research Paper help, Matlab Simulink help. Get your work
done at the best price in industry.