Skip to content

Commit

Permalink
communityimageKDD.m now prints *correct* size of ground-truth community
Browse files Browse the repository at this point in the history
  • Loading branch information
Kyle Kloster committed Jul 29, 2014
1 parent f979d20 commit e36e92e
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions communityimageKDD.m
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,15 @@

n = size(A,1);
C(n,end) = 0;
Ctop(n,end) = 0;

% find communities of size 50 < size < 500
% find communities of size 80 < size < 400
n = size(A,1);
e = ones(n,1);
commsize = e'*C;
comminds = find(commsize>50);
comminds = find(commsize(comminds)<500);
comminds = find(commsize>80);
dummy = find(commsize(comminds)<400);
comminds = comminds(dummy);
disp(length(comminds))

% now comminds contains indices of C corresponding to communities
% with size between 50 and 500.
Expand All @@ -30,11 +31,13 @@
bestfmeas = zeros(totalcommunities,2);
bestrecsize = zeros(totalcommunities,2);
condofbestfmeas = zeros(totalcommunities,2);
commsizes = zeros(totalcommunities,2);

for numcom=1:totalcommunities
comm = comminds(numcom);
verts = find(C(:,comm));

commsizes(numcom) = numel(verts);

deg = numel(verts);
recalls = zeros(deg,2); % hk = 1, ppr = 2
precisions = zeros(deg,2);
Expand Down Expand Up @@ -63,7 +66,7 @@
condofbestfmeas(numcom,functionID) = conds(trial,functionID);
end
end
fprintf('best hk = %8.4f setsize=%i cond=%6.4f \t best ppr = %8.4f setsize =%i cond=%6.4f \n',bestfmeas(numcom,1),bestrecsize(numcom,1), condofbestfmeas(numcom,1), bestfmeas(numcom,2), bestrecsize(numcom,2), condofbestfmeas(numcom,2));
fprintf('CommSize = %i \t best hk = %8.4f setsize=%i cond=%6.4f \t best ppr = %8.4f setsize =%i cond=%6.4f \n',length(verts),bestfmeas(numcom,1),bestrecsize(numcom,1), condofbestfmeas(numcom,1), bestfmeas(numcom,2), bestrecsize(numcom,2), condofbestfmeas(numcom,2));
end

fprintf('hk: mean fmeas=%6.4f \t mean setsize=%6.4f \t mean cond=%6.4f \t ppr: mean fmeas=%6.4f \t mean setsize=%6.4f \t mean cond=%6.4f \n', ...
Expand Down

0 comments on commit e36e92e

Please sign in to comment.