classification

14 次查看(过去 30 天)
gokul
gokul 2012-1-2
编辑: Greg Heath 2014-11-22
I want to learn how to do classification using Neural Network in Matlab Having Elliptical Basis Function , Can any one help .... Code is attached
What I know is that first I need to create NN and then make Decision Making
Function ( Elliptical Basis Function )
tic
maxround = 5;
hiddenLayerSize = [3 5 7 10 13];
errors = zeros(maxround,1);
trainPerformance = zeros(maxround,1);
valPerformance = zeros(maxround,1);
testPerformance = zeros(maxround,1);
timedata = zeros(maxround,1);
NoofNeurons = zeros(maxround,1);
Accuracy = zeros(maxround,1);
TestFold = zeros(maxround,1);
NoOfClasses = zeros(maxround,1);
NoofInstances = zeros(maxround,1);
SizeofInputLayer = zeros(maxround,1);
for i=1: maxround
net = patternnet(hiddenLayerSize);
net.inputs{1}.processFcns = {'removeconstantrows','mapminmax'};
NoOfinputs = net.inputs
net.outputs{2}.processFcns = {'removeconstantrows','mapminmax'};
NoOfOutPuts = net.outputs
net.divideFcn = 'dividerand'; % Divide data randomly
net.divideMode = 'sample'; % Divide up every sample
net.divideParam.trainRatio = 70/100;
net.divideParam.valRatio = 15/100;
net.divideParam.testRatio = 15/100;
net.trainFcn = 'trainlm'; % Levenberg-Marquardt
net.performFcn = 'mse'; % Mean squared error
[net,tr] = train(net,inputs,targets);
outputs = net(inputs);
errors = gsubtract(targets,outputs);
performance(i) = perform(net,targets,outputs);
trainTargets = targets .* tr.trainMask{1};
valTargets = targets .* tr.valMask{1};
testTargets = targets .* tr.testMask{1};
trainPerformance(i) = perform(net,trainTargets,outputs);
valPerformance(i) = perform(net,valTargets,outputs);
testPerformance(i) = perform(net,testTargets,outputs);
NoofNeurons(i) = hiddenLayerSize(1);
NameofDataSet = 'Heart';
TestFold(i) = i;
NoOfClasses(i) = size(targets,1); % Number of classed to be classified
NoofInstances(i) = size(targets,2); % Number of Instances
SizeofInputLayer(i) = size(inputs,2);
end
  1 个评论
Walter Roberson
Walter Roberson 2012-1-2
Thank you for taking the time to format your code!

请先登录,再进行评论。

采纳的回答

Greg Heath
Greg Heath 2012-1-4
  2 个评论
Greg Heath
Greg Heath 2012-1-8
编辑:Greg Heath 2014-11-22
IGNORE THIS COMMENT OF 8 JAN 2012. IT IS BASED ON FAULTY LOGIC. FOR ANY OTHER VALUE OF THE LINEAR COMBINATION THAN ZERO, THE CONTOURS ARE ELLIPTIC. =========================================================================== WHOOPS! MY APOLOGIES!
I have just realized that , in general, NEWFF with RADBAS will not create EBFs. Consider a two-input net with w11*x1+w12*x2 + b1 the argument of RADBAS.
Obviously, exp(-(w11*x1+w12*x2+b1)^2) is equal to 1 along the line 0 =w11*x1+w12*x2+b1. Therefore the constant level contours are not ellipses.
Sorry for the bum steer.
Greg
Puneet Arora
Puneet Arora 2012-1-16
Then what do you suggest .. I need to change the H and O , My I-H-O is structure : 1 (inputs)-H- 4 (Outputs) and H = [1 2 4 8 16 32 64]
net = newff(minmax(ptrn),[H O],{'radbas', 'purelin'});
I m doing classification iris dataset ...

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Deep Learning Toolbox 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by