IRootLab
An Open-Source MATLAB toolbox for vibrational biospectroscopy
fcon_slda.m
Go to the documentation of this file.
1 %> @brief Sparse LDA
2 %>
3 %> <h3>References</h3>
4 %> Hastie et al, Elements of Statistical Learning, 2nd ed. Springer.
5 %>
6 %> @sa fisher_ld.m, uip_fcon_lda.m
8  properties
9  max_loadings;
10  end;
11 
12  methods
13  function o = fcon_slda()
14  o.classtitle = 'Sparse LDA';
15  o.short = 'SLDA';
16  o.flag_trainable = 1;
17  o.L_fea_prefix = 'SLDA';
18  o.flag_params = 0;
19  end;
20 
21  end;
22 
23  methods(Access=protected)
24  function o = do_train(o, data)
25 
26 % delta = 1e-3; % l2-norm constraint
27 % stop = -30; % request 30 non-zero variables
28 % maxiter = 250; % maximum number of iterations
29 % Q = 2; % request two discriminative directions
30 % convergenceCriterion = 1e-6;
31 %
32 % % normalize training and test data
33 % [X mu d] = normalize(X);
34 % X_test = (X_test-ones(n,1)*mu)./sqrt(ones(n,1)*d);
35 %
36 % % run SLDA
37 % [B theta] = slda(X, Y, delta, stop, Q, maxiter, convergenceCriterion, true);
38 
39 
40  o.L = slda(data.X, classes2boolean(data.classes), 1e-3, -20, 4, 500, 1e-24, true);
41 
42  if ~isempty(o.max_loadings)
43  o.L = o.L(:, min(size(o.L, 2), o.max_loadings));
44  end;
45 
46  o.L_fea_x = data.fea_x;
47  o.xname = data.xname;
48  o.xunit = data.xunit;
49  end;
50  end;
51 end
Feature Construction - Linear Transformations base class.
Definition: fcon_linear.m:2
function classes2boolean(in classes, in no_different)
function fisher_ld(in data, in flag_sphere, in flag_modified_s_b, in P, in n_max)
Sparse LDA.
Definition: fcon_slda.m:7