source: distools/disstat.m @ 131

Last change on this file since 131 was 10, checked in by bduin, 14 years ago
File size: 1.8 KB
RevLine 
[10]1%DISSTAT Basic information (statistics) on a dissimilarity represenatation
2%
3%   [MIN,MAX,ME,STD,SKEW] = DISSTAT(D)
4%
5% INPUT
6%   D   NxN or NxM dissimilarity matrix or dataset
7%
8% OUTPUT
9%   MIN  Vector of minimal dissimilarities per class and for the whole data   
10%   MAX  Vector of maximal dissimilarities per class and for the whole data   
11%   ME   Vector of average dissimilarities per class and for the whole data   
12%   STD  Vector of standard deviations of dissimilarities per class and for the whole data 
13%   SKEW Vector of skeweness coefficients per class and for the whole data
14%
15% DESCRIPTION
16% Basic statistics on a dissimilarity represenatation: minimum, maximum,
17% average, standard deviation and skewness are computed per class and for
18% the whole data. They are returned in vectors of the length of C+1, where C
19% is the number of classes. The last elements reflect the statistics for
20% the whole data.
21
22% Copyright: Elzbieta Pekalska, ela.pekalska@googlemail.com, Robert P.W. Duin, r.duin@ieee.org
23% Faculty EWI, Delft University of Technology and
24% School of Computer Science, University of Manchester
25
26
27function [MIN,MAX,ME,STD,SKEW] = disstat(D)
28
29if isnumeric(D)
30    DD   = D;
31    DD   = setdiff(DD(:),0);
32    MIN  = min(DD);
33    MAX  = max(DD);         
34    ME   = mean(DD);
35    STD  = std(DD);
36    SKEW = mean(((DD-ME)/STD).^3);
37else   
38    ll  = getlab(D);
39    fll = getfeatlab(D);
40    [lab,flab,lablist] = renumlab(ll,fll);
41
42    D = +D;
43    I = find(D == 0);
44
45    for i=1:max(lab)+1
46        I = find(lab == i);
47        J = find(flab == i);
48        if i < max(lab)+1
49            DD = D(I,J);
50        else
51            DD = D;
52        end
53        DD     = setdiff(DD(:),0);
54        MIN(i,1) = min(DD);
55        MAX(i,1) = max(DD);         
56        ME(i,1)  = mean(DD);
57        STD(i,1) = std(DD);
58        SKEW(i,1)= mean(((DD-ME(i))/STD(i)).^3);
59    end
60end
61return;
Note: See TracBrowser for help on using the repository browser.