-
Notifications
You must be signed in to change notification settings - Fork 0
/
run_GreeneData.m
57 lines (50 loc) · 1.47 KB
/
run_GreeneData.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
46
47
48
49
50
51
52
53
54
55
56
% For GreeneData
clc
% Input data
% Select from£ºbirthdeath, expandcontract, hide, mergesplit
nets = importdata('./Dataset/GreeneData/hide/networklist.txt');
T = length(nets);
N = 1000;
adjMatrix=cell(1,T);
for i = 1:T
% Select from£ºbirthdeath, expandcontract, hide, mergesplit
adjMatrix{i}=edgelistFile2adjMatrix(['./Dataset/GreeneData/hide/',nets{i}], N);
end
% evolutionary clustering, alpha=0.8
[result] = ESPRA( adjMatrix, 0.8, 0.5);
% save to files
% for t=1:T
% fp = fopen(['./GreeneData/hide/result_', num2str(t), '.txt'],'wt');
% r = result{t};
% for i=1:size(r, 1)
% fprintf(fp, '%d\t%d\n', r(i, 1), r(i, 2));
% end
% end
% fclose(fp);
% performance
nmi=zeros(T, 1);
errate=zeros(T, 1);
for i = 1:T
% Ground truth. Select from: birthdeath, expandcontract, hide, mergesplit
benchmark_cluster=load(['./Dataset/GreeneData/hide/t',num2str(i),'.txt']);
benchmark_cluster=benchmark_cluster(benchmark_cluster(:,1)~=0,:);
nmi(i) = NMI( result{i}, benchmark_cluster );
errate(i) = ErrorRate( result{i}, benchmark_cluster );
end
disp('---------------------------')
% figure of performance
figure();
%subplot(1,2,1);
plot(nmi, 'sr-', 'LineWidth',2, 'MarkerFaceColor','r');
grid on
%axis([0 T+1 0 1.05]);
xlabel('Time steps');
ylabel('NMI');
title('NMI over Time steps');
% subplot(1,2,2);
% plot(errate, '*b-');
% grid on
% axis([0 T+1 0 max(errate)+0.05]);
% xlabel('Time steps');
% ylabel('Error rate');
% title('Error rate over Time steps');