source: distools/vat.m @ 77

Last change on this file since 77 was 10, checked in by bduin, 14 years ago
File size: 1.4 KB
RevLine 
[10]1% VAT  Visual Assessment of cluster Tendency for dissimilarity matrices
2%
3%   DN = VAT(D)
4%
5% INPUT
6%   D   NxN symmetric dissimilarity matrix (dataset)
7%
8% OUTPUT
9%   P   Order of elements
10%   DN  Reorded and scaled dissimilarity matrix
11%
12% DESCRIPTION
13% Visualization of the distance matrix to emphasize cluster tendencies
14% by reordering the rows and columns in the distance matrix.
15%
16% REFERENCE
17% R.J.Hathaway, J.C.Bezdek, J.M.Huband, "Scalable visual assessment of
18% cluster tendency for large data sets", Pattern Recognition, vol. 39,
19% no. 7, 2006.
20%
21
22% Copyright: Pavel Paclik, Elzbieta Pekalska, ela.pekalska@googlemail.com
23% Faculty EWI, Delft University of Technology and
24% School of Computer Science, University of Manchester
25
26
27function [P,DN] = vat(D)
28
29D = +D;
30n = size(D,1);
31K = (1:n)';
32I = [];
33J = [];
34P = [];
35
36[i,j] = mmind(D,'max');
37
38P(1) = i(1);
39I    = i(1);
40J    = setdiff(K,I);
41
42for r=2:n
43  [i,j] = mmind(D(I,J),'min');
44  i     = I(i(1));
45  j     = J(j(1));
46
47  P = [P; j];
48  I = [I; j];
49  J = setdiff(J,j);
50end
51if nargout >1
52  DN = D(P,P);
53
54  % make linear stretch
55  mi = min(min(D));
56  ma = max(max(D));
57  k  = 256/(ma-mi);
58  DN = floor(k*DN-mi*k);
59end
60return
61
62
63
64
65function [i,j] = mmind(A,FUNC)
66% Return all indices that are maximum (minimum) in the matrix.
67% Function is specified by the FUNC string.
68
69eval(['[m,ind]=' FUNC '(' FUNC '(A));']);
70ind   = find(A==m(1));
71[i,j] = ind2sub(size(A),ind);
72return
Note: See TracBrowser for help on using the repository browser.