-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMAEDseq.m
45 lines (41 loc) · 1.36 KB
/
MAEDseq.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
function smpRank = MAEDseq(K,selectNum,splitLabel,ReguAlpha)
% MAED: Manifold Adaptive Experimental Design with Sequential Optimization
%
% smpRank = MAEDseq(K,selectNum,splitLabel,ReguAlpha)
%
% This function will be called by MAED.m
%
%Reference:
%
% [1] Deng Cai and Xiaofei He, "Manifold Adaptive Experimental Design for
% Text Categorization", IEEE Transactions on Knowledge and Data
% Engineering, vol. 24, no. 4, pp. 707-719, 2012.
%
% [2] K. Yu, J. Bi, and V. Tresp, "Active Learning via Transductive
% Experimental Design," ICML 2006.
%
% version 2.0 --Jan/2012
% version 1.0 --Aug/2008
%
% Written by Deng Cai (dengcai AT gmail.com)
%
if sum(splitLabel) + selectNum > size(K,1)
error('You are requiring too many points!');
end
if sum(splitLabel)
Klabel = K(splitLabel,splitLabel);
K = K - (K(:,splitLabel)/(Klabel+ReguAlpha*speye(size(Klabel))))*K(splitLabel,:);
end
splitCandi = true(size(K,2),1);
if sum(splitLabel)
splitCandi = splitCandi & ~splitLabel;
end
smpRank = zeros(selectNum,1);
for sel = 1:selectNum
DValue = sum(K(:,splitCandi).^2,1)./(diag(K(splitCandi,splitCandi))'+ReguAlpha);
[value,idx] = max(DValue);
CandiIdx = find(splitCandi);
smpRank(sel) = CandiIdx(idx);
splitCandi(CandiIdx(idx)) = false;
K = K - (K(:,CandiIdx(idx))*K(CandiIdx(idx),:))/(K(CandiIdx(idx),CandiIdx(idx))+ReguAlpha);
end