-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmyNMIACC.m
26 lines (25 loc) · 897 Bytes
/
myNMIACC.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
function [res]= myNMIACC(U,Y,numclass)
stream = RandStream.getGlobalStream;
reset(stream);
U_normalized = U ./ repmat(sqrt(sum(U.^2, 2)), 1, size(U, 2));
maxIter = 50;
% tmp1 = zeros(maxIter,1);
% tmp2 = zeros(maxIter,1);
% tmp3 = zeros(maxIter,1);
% for iter = 1:maxIter
% indx = litekmeans(U_normalized,numclass,'MaxIter',100, 'Replicates',1);
% indx = indx(:);
% [newIndx] = bestMap(Y,indx);
% tmp1(iter) = mean(Y==newIndx);
% tmp2(iter) = MutualInfo(Y,newIndx);
% tmp3(iter) = purFuc(Y,newIndx);
% end
% res = [max(tmp1);max(tmp2);max(tmp3)];
%U_normalized = gather(U_normalized);
indx = litekmeans(U_normalized,numclass, 'MaxIter',100, 'Replicates',maxIter);
% indx = kmeans(U_normalized,numclass, 'MaxIter',100, 'Replicates',maxIter);
indx = indx(:);
[newIndx] = bestMap(Y,indx);
res(1) = mean(Y==newIndx);
res(2) = MutualInfo(Y,newIndx);
res(3) = purFuc(Y,newIndx);