画图和计算结果准确率的matlab代码
%matrix横坐标featureDimension,纵坐标N_corpus
featureDimension=[10,20,30,40,50,60,70,80,90,100,110,120,130,140,150];
N_corpus=[100,500,1000,1500,2000,2500,3000];
matrix0=load('0.txt');
matrix1=load('1.txt');
matrix2=load('2.txt');
matrix3=load('3.txt');
matrix4=load('4.txt');
avaMatrix=(matrix0+matrix1+matrix2+matrix3+matrix4)/5
savefile='avaAccuracy.txt';
save avaAccuracy.txt avaMatrix -ascii
[Y,I]=max(avaMatrix')
figure(1)
set(1,'position',[10,50,500,500]);
plot(featureDimension,avaMatrix(1,:),'-bo')
hold on
plot(featureDimension,avaMatrix(2,:),'-g*')
hold on
plot(featureDimension,avaMatrix(3,:),'-rs')
hold on
plot(featureDimension, avaMatrix(4,:),'-cv')
axis([10,150,60,105])
text(30,100,'(注: "blue" represents corpussize=200 "green" reprensents corpussize=1000,"red" represents corpussize=2000, "cyan represents corpussize=3000" )')
title('特征维数对分类准确率的影响')
xlabel('特征维数')
ylabel('准确率')
hold off
featureDimension=[10,20,30,40,50,60,70,80,90,100,110,120,130,140,150];
N_corpus=[100,500,1000,1500,2000,2500,3000];
matrix0=load('0.txt');
matrix1=load('1.txt');
matrix2=load('2.txt');
matrix3=load('3.txt');
matrix4=load('4.txt');
avaMatrix=(matrix0+matrix1+matrix2+matrix3+matrix4)/5
savefile='avaAccuracy.txt';
save avaAccuracy.txt avaMatrix -ascii
[Y,I]=max(avaMatrix')
figure(1)
set(1,'position',[10,50,500,500]);
plot(featureDimension,avaMatrix(1,:),'-bo')
hold on
plot(featureDimension,avaMatrix(2,:),'-g*')
hold on
plot(featureDimension,avaMatrix(3,:),'-rs')
hold on
plot(featureDimension, avaMatrix(4,:),'-cv')
axis([10,150,60,105])
text(30,100,'(注: "blue" represents corpussize=200 "green" reprensents corpussize=1000,"red" represents corpussize=2000, "cyan represents corpussize=3000" )')
title('特征维数对分类准确率的影响')
xlabel('特征维数')
ylabel('准确率')
hold off