Rev | Line | |
---|
[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 | |
---|
| 27 | function [P,DN] = vat(D) |
---|
| 28 | |
---|
| 29 | D = +D; |
---|
| 30 | n = size(D,1); |
---|
| 31 | K = (1:n)'; |
---|
| 32 | I = []; |
---|
| 33 | J = []; |
---|
| 34 | P = []; |
---|
| 35 | |
---|
| 36 | [i,j] = mmind(D,'max'); |
---|
| 37 | |
---|
| 38 | P(1) = i(1); |
---|
| 39 | I = i(1); |
---|
| 40 | J = setdiff(K,I); |
---|
| 41 | |
---|
| 42 | for 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); |
---|
| 50 | end |
---|
| 51 | if 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); |
---|
| 59 | end |
---|
| 60 | return |
---|
| 61 | |
---|
| 62 | |
---|
| 63 | |
---|
| 64 | |
---|
| 65 | function [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 | |
---|
| 69 | eval(['[m,ind]=' FUNC '(' FUNC '(A));']); |
---|
| 70 | ind = find(A==m(1)); |
---|
| 71 | [i,j] = ind2sub(size(A),ind); |
---|
| 72 | return |
---|
Note: See
TracBrowser
for help on using the repository browser.