📄 ide.m
字号:
%the code for treec and pca is in the PRTools 3.1.7 (it is a matlab free toolbox)
%the code for NPE is available at
%http://www.cs.uiuc.edu/homes/dengcai2/Data/data.html
function [SCORE]=IDE(TR,TE,y,yy, Nensemble)
%TR= training set with label y
%TE test set with label yy
% Nensemble is the number of classifiers build for each class
for i=1:max(y)
for ii=1: Nensemble
% bagging like selection
[aa,bb]=sort(rand(size(TR(find(y==i),:),1),1));
Ftr=TR(find(y==i),:);
Ftr=Ftr(bb(1:size(Ftr,1)*0.637),:);
%creation of the PCA space
[W] = pca(dataset(Ftr),0.98);
%projection on the PCA space
NTR=+(W*dataset(TR));
NTE=dataset(TE)*W;
clear W
options = [];
options.k = 5;
options.NeighborMode = 'Supervised';
options.gnd = y;
[eigvector, eigvalue] = NPE(options, NTR);
NTR = NTR*eigvector;
NTE = NTE*eigvector;
w7=treec(dataset(NTR,y'),'infcrit',2);
clear NTR
if ii==1 & i==1
SCORE=+(w7*dataset(NTE));
else
SCORE=SCORE+(w7*dataset(NTE));
end
end
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -