1function [DBI]=DavisBouldinIndex(d,c,kk);
2% Davis-Bouldin-Index is a Cluster separation index (CSI)
3
4% KAPPA.M estimates Cohen's kappa coefficient
5%
6% [kap,sd,H,z,OA,SA,MI] = kappa(d1,d2);
7% [kap,sd,H,z,OA,SA,MI] = kappa(H);
8%
9% d1    data of scorer 1
10% d2    data of scorer 2
11%
12% kap	Cohen's kappa coefficient point
13% se	standard error of the kappa estimate
14% H	data scheme (Concordance matrix or confusion matrix)
15% z	z-score
16% OA	overall agreement
17% SA	specific agreement
18% MI 	Mutual information or transfer information (in [bits])
19%
20% Reference(s):
21%   [1] Bezdek, J.C.; Pal, N.R.; Some new indexes of cluster validity
22% Systems, Man and Cybernetics, Part B, IEEE Transactions on Volume 28, Issue 3, June 1998 Page(s):301 - 315
23%
24%
25
26% http://www.ucl.ac.uk/oncology/MicroCore/HTML_resource/distances_popup.htm
27
28%	$Id$
29%	Copyright (c) 2006 by Alois Schloegl <alois.schloegl@gmail.com>
30%    	This is part of the BIOSIG-toolbox http://biosig.sf.net/
31
32% This library is free software; you can redistribute it and/or
33% modify it under the terms of the GNU Library General Public
34% License as published by the Free Software Foundation; either
35% version 2 of the License, or (at your option) any later version.
36%
37% This library is distributed in the hope that it will be useful,
38% but WITHOUT ANY WARRANTY; without even the implied warranty of
39% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
40% Library General Public License for more details.
41%
42% You should have received a copy of the GNU Library General Public
43% License along with this library; if not, write to the
44% Free Software Foundation, Inc., 59 Temple Place - Suite 330,
45% Boston, MA  02111-1307, USA.
46%
47
48
49CL = unique(c);
50M = length(CL);
51
52t = 2; q = 2;
53D = zeros(M,M);
54
55for k=1:M,
56        %v(k,:)=mean(dk,1);    % center of each cluster
57        [dk, v(k,:)] = center(d(c==CL(k),:),1);
58        S(k) = sum(sqrt(sum(dk.^2,2)).^q).^(1/q);
59end;
60
61for k1=1:M,
62for k2=1:M,
63        d(k1,k2)= sum(abs(v(k1,:)-v(k2,:)).^t).^(1/t);  % Minkowski Distance of order t
64end;
65end;
66
67[x,y] = meshgrid(S);
68DBI = mean(max((x+y)./D + diag(repmat(NaN,1,M))));
69
70
71