classification

15 Ansichten (letzte 30 Tage)
gokul
gokul am 2 Jan. 2012
Bearbeitet: Greg Heath am 22 Nov. 2014
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 Kommentar
Walter Roberson
Walter Roberson am 2 Jan. 2012
Thank you for taking the time to format your code!

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Greg Heath
Greg Heath am 4 Jan. 2012
  2 Kommentare
Greg Heath
Greg Heath am 8 Jan. 2012
Bearbeitet: Greg Heath am 22 Nov. 2014
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 am 16 Jan. 2012
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 ...

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Deep Learning Toolbox finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by