Code covered by the BSD License
-
[total,Evector]=OQDF_M(tr,trl...
-
[total,ml]=NC(tr,trl,te,tel)
-
[total]=OQDF_E(tr,trl,te,tel,...
-
[total]=OQDF_L(tr,trl,te,tel,...
-
total=KNN(tri,trl,tei,tel,k)
total=total/mte*100;
-
total=nntrte(tri,trl,tei,tel)
-
Sample_test.m
-
View all files
|
|
| total=KNN(tri,trl,tei,tel,k)
|
function total=KNN(tri,trl,tei,tel,k)
[mte,n]=size(tei);
str=sum(tri'.*tri');
ste=sum(tei'.*tei');
tel1=zeros(mte,1);
for i=1:mte;
d=str+ste(i)-2*tei(i,:)*tri';
[dv,dl]=sort(d);
tel_temp=trl(dl(1:k));
class=1;tel_c=tel_temp(1);tel_n=1;
for j=2:k;
judge=0;
for l=1:class;
if tel_c(l)==tel_temp(j);
tel_n(l)=tel_n(l)+1;
judge=1;
end;
end;
if judge==0;
class=class+1;
tel_c(class)=tel_temp(j);
tel_n(class)=1;
end;
end;
[dv,dl]=max(tel_n);
tel1(i)=tel_c(dl);
end;
total=0;
for i=1:mte;
if tel1(i)~=tel(i);
total=total+1;
end;
end;
%total=total/mte*100;
|
|
Contact us at files@mathworks.com