during the classification of malayalam short vowel classification ,i'm getting the accuracy of 20%.How can i increase the accuracy,
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
the code is given below.How can i increase the accuracy with respect to the vowel classification.
clear; clc; DatabasePath='D:\Education\3sem\project\newspeech(mv)\mv_database'; NumberOfVowels=5; NumberOfSamplesPerVowel=250; k1=1; k2=1; %x=zeros(500,3500); for index1=1 : NumberOfVowels FolderName=sprintf('%s\\%d',DatabasePath,index1); for index2=1 : NumberOfSamplesPerVowel sn=wavread(sprintf('%s\\%d.wav',FolderName,index2)); if index2<=125 TrainData(k1,:)=sn(1:1100); k1=k1+1; else TestData(k2,:)=sn(1:1100); k2=k2+1; end %sound(x1,fs1); end end [P,N]=size(TrainData);
%finding the minimum and maximum min1=min(TrainData(1:P,:)); max1=max(TrainData(1:P,:));
% Finding the normalizes data
for i=1:N for j=1:P Train_norm(j,i)=(TrainData(j,i)-min1(i))/(max1(i)-min1(i)); end end min2=min(TestData(1:P,:)); max2=max(TestData(1:P,:));
% Finding the normalizes data
for i=1:N for j=1:P Test_norm(j,i)=(TestData(j,i)-min2(i))/(max2(i)-min2(i)); end end
m1=mean(Train_norm(1:125,:)); m2=mean(Train_norm(126:250,:)); m3=mean(Train_norm(251:375,:)); m4=mean(Train_norm(376:500,:)); m5=mean(Train_norm(501:625,:));
% within class scatter matrix of class 1 Sw1=zeros(1100); for i=1:125 Diff=Train_norm(i,:)-m1; Sw1=Sw1+(Diff'*Diff); end
% within class scatter matrix of class 2 Sw2=zeros(1100); for i=126:250 Diff=Train_norm(i,:)-m2; Sw2=Sw2+(Diff'*Diff); end % within class scatter matrix of class 3 Sw3=zeros(1100); for i=251:375 Diff=Train_norm(i,:)-m3; Sw3=Sw3+(Diff'*Diff); end % within class scatter matrix of class 4 Sw4=zeros(1100); for i=376:500 Diff=Train_norm(i,:)-m4; Sw4=Sw4+(Diff'*Diff); end % within class scatter matrix of class 5 Sw5=zeros(1100); for i=501:625 Diff=Train_norm(i,:)-m5; Sw5=Sw5+(Diff'*Diff); end
% sum of within class scatter matrix Sw=Sw1+Sw2+Sw3+Sw4+Sw5;
% total mean m=(m1+m2+m3+m4+m5)/5;
% between class scatter matrix Sb1=125*(m1-m)'*(m1-m); Sb2=125*(m2-m)'*(m2-m); Sb3=125*(m3-m)'*(m3-m); Sb4=125*(m4-m)'*(m4-m); Sb5=125*(m5-m)'*(m5-m); Sb=Sb1+Sb2+Sb3+Sb4+Sb5;
% Computation of eigenvectors and eigen value [Evect,Eval]=eig(inv(Sw)*Sb); [Eval,ind]=sort(diag(Eval),'descend'); no_of_dim=4; EV1=Evect(:,ind(1:no_of_dim)); projtrain_data=Train_norm*EV1; projtest_data=Test_norm*EV1; projtest_data=TestData*EV1; class(1:125)=1; class(126:250)=2; class(251:375)=3; class(376:500)=4; class(501:625)=5; %gscatter(TrainData(:,1),TrainData(:,2),class); class=class'; oclass=knnclassify(projtest_data,projtrain_data,class,15); %figure,gscatter(TestData(:,1),TestData(:,2),oclass,'mc'); figure, plot(oclass(1:125,1),'*r'); hold on; plot(oclass(126:250,1),'+g'); hold on; plot(oclass(251:375,1),'^b'); hold off; c=confusionmat(class,oclass) correct=diag(c); accuracy=(sum(correct)/625)*100; display(accuracy);
0 Kommentare
Antworten (0)
Siehe auch
Kategorien
Mehr zu Image Data Workflows finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!