Line | |
---|
1 | %DISMATSEL Forward selection and combination of dissimilarity datasets
|
---|
2 | %
|
---|
3 | % [D,L,E] = DISMATSEL(C)
|
---|
4 | %
|
---|
5 | % C is a cell array of labeled datasets being square dissimilarity
|
---|
6 | % matrices. In a forward selection the best of them according to the
|
---|
7 | % leave-one-out nearest neighbor error (NNE) are selected and summed.
|
---|
8 | % L contains the ranked set of indices of selected matrices. E stores the
|
---|
9 | % error and D is the sum of the best subset.
|
---|
10 | %
|
---|
11 | % SEE ALSO
|
---|
12 | % DATASETS, NNE
|
---|
13 |
|
---|
14 | % Copyright: R.P.W. Duin, r.p.w.duin@prtools.org
|
---|
15 | % Faculty EWI, Delft University of Technology
|
---|
16 | % P.O. Box 5031, 2600 GA Delft, The Netherlands
|
---|
17 |
|
---|
18 | function [d_final,L,E] = dismatsel(c,nmax)
|
---|
19 |
|
---|
20 | if ~iscell(c) | ~isdataset(c{1})
|
---|
21 | error('Cell array of dissimilarity matrices expected')
|
---|
22 | end
|
---|
23 |
|
---|
24 | n = length(c);
|
---|
25 | if nargin < 2, nmax = n; end
|
---|
26 | for j=1:n
|
---|
27 | c{j} = abs(c{j});
|
---|
28 | c{j} = setfeatlab(c{j},getlabels(c{j}));
|
---|
29 | c{j} = c{j}*disnorm(c{j});
|
---|
30 | end
|
---|
31 | L = zeros(1,nmax);
|
---|
32 | J = [1:n];
|
---|
33 | E = zeros(1,nmax);
|
---|
34 | d = zeros(size(c{1}));
|
---|
35 | emin_total = 1;
|
---|
36 | for j=1:nmax
|
---|
37 | emin = 1;
|
---|
38 | for i=J
|
---|
39 | e = nne(c{i}+d);
|
---|
40 | if e < emin
|
---|
41 | L(j) = i;
|
---|
42 | emin = e;
|
---|
43 | end
|
---|
44 | end
|
---|
45 | d = c{L(j)}+d;
|
---|
46 | if nargin < 2 % do not allow multiple choices
|
---|
47 | J(J==L(j)) = [];
|
---|
48 | end
|
---|
49 | E(j) = emin;
|
---|
50 | if emin < emin_total
|
---|
51 | emin_total = emin;
|
---|
52 | d_final = d;
|
---|
53 | end
|
---|
54 | end
|
---|
55 |
|
---|
56 |
|
---|
57 |
|
---|
58 |
|
---|
59 |
|
---|
60 |
|
---|
61 |
|
---|
Note: See
TracBrowser
for help on using the repository browser.