|
|
【答案】应助回帖
★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ... 感谢参与,应助指数 +1 qishuai84: 金币+70, ★★★很有帮助 2013-10-23 10:36:53
A11,A21,A31,A41,A51,A61:1557*44
A12,A22,A32,A42,A52,A62:1557*22
y1:
A=[A11,A21,A31,A41,A51,A61]';
B=[A12,A22,A32,A42,A52,A62]';
plot(A')
plot(B')
[Xcal]=snv(A);
plot(Xcal')
[Xtest]=snv(B);
plot(Xtest')
[coeff1, score1, latent1] = PRINCOMP(Xcal);
%[coeff2, score2, latent2] = PRINCOMP(Xtest);
score2=Xtest*coeff1;
y1=[ones(44,1); 2*ones(44,1); 3*ones(44,1); 4*ones(44,1); 5*ones(44,1);6*ones(44,1)];
y2=[ones(22,1); 2*ones(22,1); 3*ones(22,1); 4*ones(22,1); 5*ones(22,1);6*ones(22,1)];
x1=score1(:,1:5);
x2=score2(:,1:5);
%预测集
L=classify(x2, x1, y1, 'linear');
L-y2;
v=find(L-y2==0);
length(v)/132
%校正集
L=classify(x1, x1, y1, 'linear');
L-y1;
v=find(L-y1==0);
length(v)/264 |
|