-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathobjectivefunction.m
More file actions
41 lines (34 loc) · 872 Bytes
/
Copy pathobjectivefunction.m
File metadata and controls
41 lines (34 loc) · 872 Bytes
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
function [fitness,label]=objectivefunction(PredictClass,para,K,truelabels,X1)
dcASRS = 0.8;
R = 5;
dcSRS = 0.8;
dcCTS = 0.8;
%%%%1 for cts, 2 forASRS, 3 for SRS
if para(1)==1
S = cts(PredictClass, dcCTS);
elseif para(1)==2
S = asrs(PredictClass, dcASRS);
else
S = srs(PredictClass, dcSRS, R);
end
%%%%1 for kmeans, 2 forAL, 3 for CL, 4 for
dis = stod(S); %convert similarity matrix to distance vector
if para(2)==1
label = kmeans(S,K);
while length(unique(label)) ~= K;
label = kmeans(S,K);
end
elseif para(2)==2
fig_flag=0;
label1 = spectral_clustering(S, K, fig_flag);
[~,label]=max(label1');
label=label';
elseif para(2)==3
dist = pdist2(S,S);
[cluster_lables] = cluster_dp(dist,K);
label=cluster_lables';
end
V = cleval(X1, label, truelabels);
fitness=V(1:2);
%fitness(1)= V(2);
%fitness(2)= V(3);