problems in the classification
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
felipe gonzalez
am 21 Mai 2015
Kommentiert: Greg Heath
am 24 Mai 2015
hello matlab community ..... I'm working with a neural network capable of classifying patterns, I have no one to turn to ... my network is not ranking very well .... it classifies all results in just a standard ... and in fact I have to classify three types ... if someone can help me to improve this algortimo'll be very grateful not know where I am going wrong ... I am so frustrated right now ... thank you
clear all close all clc
n = input('enter the first layer of neurons number\n') ;
m = input('enter the number of the neurons of the second layer\n') ;
a = input('digite 1-(40),2-(45),3-(50),4-(60),5-(70),6-(80) \n') ;
p = input('enter the number of samples you want to test\n') ;
switch a
case 1
[x] = xlsread('d_40S.xlsx') ;
case 2
[x] = xlsread('d_45S.xlsx') ;
case 3
[x] = xlsread('d_50S.xlsx') ;
case 4
[x] = xlsread('d_60S.xlsx') ;
case 5
[x] = xlsread('d_70S.xlsx') ;
case 6
[x] = xlsread('d_80S.xlsx') ;
end
[y] = xlsread('target_3eS.xlsx') ;
[w,k] = size(y) ;
%grouping the data matrix and target
matriz_dados = [x y] ;
%scrambling the matrix so as to become more random
dados = permutation(matriz_dados) ;
[l,c] = size(dados) ;
%separating training samples and testing randomly
idx = randperm(l);
id_teste = (idx <= p) ;
id_treino = (idx > p) ;
%matrix with complete set of data
dado_treino = dados(id_treino,:) ; %sample for training
dado_teste = dados(id_teste,:) ; %Test sample
%samples for training
dadotreino = dado_treino(:,1:c-k)' ;
tagtreino = dado_treino(:,c-(k-1):c)' ;
%samples for validation
dadoteste = dado_teste(:,1:c-k)' ;
tagteste = dado_teste(:,c-(k-1):c)' ;
%---------------------------------------------------------
rede = network ; %network name
rede.numinputs = 1 ;%amount of input that the network layers have
rede.numlayers = 3; %number of network layers that have
rede.biasConnect = [1; 1;1] ;%Is defined now the layers that have associated bias
%1 = will bias,0 =You will not have bias
rede.inputConnect = [1 ;0 ;0] ;%connecting the inputs network layers
rede.layerConnect = [0 0 0 ; 1 0 0;0 1 0] ;%Connection between layers
rede.outputConnect = [0 0 1] ;%layers that have connection with the output
rede.inputs{1}.range = [0 1] ;% maximum and minimum value that can take the variables
t = c -(c-k) ;
rede.inputs{1}.size = c-k ;
rede.layers{1}.size = n ;
rede.layers{2}.size = m ;
rede.layers{3}.size = t ;
for j=1:t
rede.layers{j}.transferFcn ='logsig' ;
rede.layers{j}.initFcn = 'initnw' ;
end
rede.performFcn = 'mse';
rede.trainFcn = 'trainrp';
rede.trainParam.epochs = 10000 ;
rede.view
rede = init(rede) ;
train_rede = train(rede,dadotreino,tagtreino) ;
output = rede(dadoteste) ;
output_final = vec2ind(output)' ;
% Y = sim(rede, dadoteste) ; % z = vec2ind(Y)' ;
tagtest2 = vec2ind(tagteste)' ;
M = confusionmat(tagtest2,output_final)
0 Kommentare
Akzeptierte Antwort
Greg Heath
am 24 Mai 2015
help patternnet
doc patternnet
Search the NEWSGROUP and ANSWERS
greg patternnet
If you go to
help nndatasets
doc nndatasets
and choose a classification/pattern-recognition data set,
I will compare yor patternnet results with mine.
Hope this helps.
Thank you for formally accepting my answer
Greg
2 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Sequence and Numeric Feature Data Workflows finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!