forked from ipsorakis/GeneralNetworkTools
-
Notifications
You must be signed in to change notification settings - Fork 1
/
run_newman_sensitivity_analysis.m
59 lines (49 loc) · 2.16 KB
/
run_newman_sensitivity_analysis.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
57
58
59
%% INITIALIZE
output_directory = 'Reports/report-15-3-2010/sensitivity/';
methods = {'nmf','Spectral','Hierarchical','EO'};
K = 16;
Kout_max=K/2;
reruns=100;
Q_spectral = zeros(reruns,length(methods));
Q_EO = zeros(reruns,length(methods));
Q_nmf = zeros(reruns,length(methods));
Q_hier = zeros(reruns,length(methods));
I_spectral = zeros(reruns,length(methods));
I_EO = zeros(reruns,length(methods));
I_nmf = zeros(reruns,length(methods));
I_hier = zeros(reruns,length(methods));
%% RUN SENSITIVITY FOR VARIOUS Kout
for kout=1:Kout_max
disp('========== RERUN ===============')
disp(kout)
for rerun_index=1:reruns
[A groups] = get_newman_random_graph(K-kout);
N = size(A,1);
W=A;
for method_index = 1:length(methods)
if strcmp(methods{method_index},'Spectral')
%% SPECTRAL PARTITIONING
[~, Qmonitor, best_iteration, best_group Iab] = spectral_partitioning(W,10,true,false,groups);
Q_spectral(rerun_index,kout) = Qmonitor(best_iteration);
I_spectral(rerun_index,kout) = Iab;
elseif strcmp(methods{method_index},'EO')
%% EXTREMAL OPTIMIZATION
[~, Qmonitor, best_iteration, best_group Iab] = extremal_optimization(W,10,true,false,groups);
Q_EO(rerun_index,kout) = Qmonitor(best_iteration);
I_EO(rerun_index,kout) = Iab;
elseif strcmp(methods{method_index},'nmf')
%% NON-NEGATIVE MATRICES
[best_group,Qbest,~,~,~,Iab] = cm_nmf(W,10,0,groups);
Q_nmf(rerun_index,kout) = Qbest;
I_nmf(rerun_index,kout) = Iab;
elseif strcmp(methods{method_index},'Hierarchical')
%% HIERARCHICAL CLUSTERING
[~, Qmonitor, best_iteration, best_group, Iab] = hierachical_clustering(W,N,false,'complete-linkage','pearson',-1,-1,groups);
Q_hier(rerun_index,kout) = Qmonitor(best_iteration);
I_hier(rerun_index,kout) = Iab;
end
end
end
disp('-------------------')
end
save(strcat(output_directory,'sensitivity100reruns'))