how to classify two class using neural network

 Respuesta aceptada

Greg Heath
Greg Heath el 16 de Abr. de 2013

0 votos

patternnet
help patternnet
doc patternnet
Hope this helps.
Greg

3 comentarios

sir..this is the coding i got from somewhere for probabilistic neural network. X = [7.02 1;50.13 5;90.1 9;86.08 9;62 4;59.9 15;35.6 20;35.5 60;70.89 48;40.3 80]';
Tc = [1 2 3 4 5 6 7 8 9 10];
plot(X(1,:),X(2,:),'.','markersize',20)
for i=1:10
text(X(1,i)+0.1,X(2,i),sprintf('class %g',Tc(i))),
end
% axis([0 200 0 200])
title('Ten vectors and their classes.')
xlabel('X(1,:)')
ylabel('X(2,:)')
%.......................................
T = ind2vec(Tc);
spread = 1;
net = newpnn(X,Tc,spread); ........................................%
% Y = sim(net,X,Tc);
% Y = net(X);
Y= X';
Yc = vec2ind(Y);
figure;
plot(X(1,:),X(2,:),'.','markersize',30)
% axis([0 200 0 200])
for i=1:10,text(X(1,i)+0.1,X(2,i),sprintf('class %g',Yc(i))),
end
title('Testing the network.')
xlabel('X(1,:)')
ylabel('X(2,:)')
%......................................%
x = [20; 10.5];
y=x';
% y = net(x);
ac = vec2ind(y);
hold on
plot(x(1),x(2),'.','markersize',30,'color',[1 0 0])
text(x(1)+0.1,x(2),sprintf('class %g',ac))
hold off
title('Classifying y new vector.')
xlabel('X(1,:) and x(1)')
ylabel('X(2,:) and x(2)')
may you tell me what the flow of the program
sir..this is the coding i got from somewhere for probabilistic neural network. X = [7.02 1;50.13 5;90.1 9;86.08 9;62 4;59.9 15;35.6 20;35.5 60;70.89 48;40.3 80]';
Tc = [1 2 3 4 5 6 7 8 9 10];
plot(X(1,:),X(2,:),'.','markersize',20)
for i=1:10
text(X(1,i)+0.1,X(2,i),sprintf('class %g',Tc(i))),
end
% axis([0 200 0 200])
title('Ten vectors and their classes.')
xlabel('X(1,:)')
ylabel('X(2,:)')
%.......................................
T = ind2vec(Tc);
spread = 1;
net = newpnn(X,Tc,spread); ........................................%
% Y = sim(net,X,Tc);
% Y = net(X);
Y= X';
Yc = vec2ind(Y);
figure;
plot(X(1,:),X(2,:),'.','markersize',30)
% axis([0 200 0 200])
for i=1:10,text(X(1,i)+0.1,X(2,i),sprintf('class %g',Yc(i))),
end
title('Testing the network.')
xlabel('X(1,:)')
ylabel('X(2,:)')
%......................................%
x = [20; 10.5];
y=x';
% y = net(x);
ac = vec2ind(y);
hold on
plot(x(1),x(2),'.','markersize',30,'color',[1 0 0])
text(x(1)+0.1,x(2),sprintf('class %g',ac))
hold off
title('Classifying y new vector.')
xlabel('X(1,:) and x(1)')
ylabel('X(2,:) and x(2)')
may you tell me what the flow of the program
Greg Heath
Greg Heath el 1 de Mayo de 2013
I have a better idea:
1. Run the program
2. Run again with semicolons removed
3. Study the results
4. If you have any questions, repost with comments before every line you understand and a line of question marks before every line you do not understand.
Greg

Iniciar sesión para comentar.

Más respuestas (0)

Productos

Etiquetas

Preguntada:

el 16 de Abr. de 2013

Community Treasure Hunt

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

Start Hunting!

Translated by