source: distools/checksubeucl.m @ 40

Last change on this file since 40 was 10, checked in by bduin, 14 years ago
File size: 1.1 KB
Line 
1%CHECKSUBEUCL Find probabilities for non-Euclidean subsets
2%
3%       NEP = CHECKSUBEUCL(D,N)
4%
5% For every size of subsets of the dissimilarity matrix D at random
6% N of such subsets are taken and checked on their Euclideaness.
7% In NEP(n) the fraction of non-Euclidean subsets is returned for
8% subsets of size n. Default N = 500.
9
10%  SEE ALSO
11%  PSEM, CHECKEUCL, CHECKTR
12
13% Copyright: R.P.W. Duin, r.p.w.duin@prtools.org
14% Faculty EWI, Delft University of Technology
15% P.O. Box 5031, 2600 GA Delft, The Netherlands
16
17function nep = checksubeucl(d,reps)
18
19if nargin < 2 | isempty(reps), reps = 500; end
20discheck(d)
21m = size(d,1);
22d = dataset(+d,1);
23d = setfeatlab(d,ones(m,1));
24
25[nef ner] = checkeucl(d);
26nep = zeros(1,m);
27if ner > 1e-6
28  s = sprintf('Check sub-euclidean probs %i trials: ',reps);
29  prwaitbar(reps,s);
30  for n=1:reps
31                prwaitbar(reps,n,[s int2str(n)]);
32    J = randperm(m);
33    for j=3:m
34      [nef ner] = checkeucl(d(J(1:j),J(1:j)));
35      if ner>1e-6
36        nep(j:end) = nep(j:end) + 1;
37        break
38      end
39    end
40  end
41  nep = nep/reps;
42        prwaitbar(0)
43end
44 
Note: See TracBrowser for help on using the repository browser.