1 %>@brief FSG that uses classifier to grade the subsets
3 %> The grades are classification rates expressed in percentages (from 0 to 100)
5 %> If not
using SGS, must assign a 2-dataset vector to @ref data
7 %> @sa uip_fsg_clssr.m,
reptt
12 %> (Optional) Block to post-process the test data. For example, a @ref
grag_classes_first.
14 %> Block to post-process the estimation issued by the classifier. Examples:
21 function s = get_yname(o)
22 s = o.estlog.get_legend();
24 function s = get_yunit(o)
29 methods(Access=protected)
30 %> Cross-validation is performed here.
31 %> return a (no_pairs)x(no_idxs)x(no_test_sets) grades vector
32 function z = do_calculate_pairgrades(o, idxs)
34 [npair, ntt] = size(o.datasets); % number of pairs, number of sub-datasets
36 z = zeros(npair, nidx);
37 for ipair = 1:npair % Pairwise LOOP
38 for itt = ntt:-1:1 % Backwards to
pre-allocate
39 train_test(:, itt) = o.datasets(ipair, itt).select_features(idxs)';
45 cl = cl.train(train_test(iidx, 1));
48 est = cl.use(train_test(iidx, k));
49 est = o.postpr_est.use(est);
51 if ~isempty(o.postpr_test)
52 ds_test = o.postpr_test.use(train_test(iidx, k));
54 ds_test = train_test(iidx, k);
57 pars = struct('est', {est},
'ds_test', {ds_test},
'clssr', {cl});
59 lo = o.estlog.allocate(1);
61 z(ipair, iidx, k-1) = lo.get_rate();
66 npair = numel(o.subddd);
67 [nreps, ntt] = size(o.subddd{1});
69 z = zeros(npair, nidx);
70 for ipair = 1:npair % Pairwise LOOP
75 dnows(irep, k, :) = dd(irep, k).select_features(idxs);
79 for iidx = 1:nidx % Feature Subset LOOP
80 % Allocates one log per test set
82 lo(k-1) = o.estlog.allocate(nreps);
85 for irep = 1:nreps % Cross-validation loop
87 cl = cl.train(dnows(irep, 1, iidx));
90 est = cl.use(dnows(irep, k, iidx));
91 est = o.postpr_est.use(est);
93 if ~isempty(o.postpr_test)
94 ds_test = o.postpr_test.use(dnow(k));
96 ds_test = dnows(irep, k, iidx);
99 pars = struct('est', {est},
'ds_test', {ds_test},
'clssr', {cl});
100 lo(k-1) = lo(k-1).record(pars);
105 z(ipair, iidx, k-1) = lo(k-1).get_rate();
117 %> @arg Makes sure that @ref postpr_est is able to decide
120 if isempty(o.postpr_est)
122 o.postpr_est = decider();
127 z = estlog_classxclass();
128 z.estlabels = o.datasets(1, 1).classlabels;
129 z.testlabels = z.estlabels;
133 % Checks if postpr_est is ok; boots the post-processors
134 if ~isempty(o.postpr_est)
135 o.postpr_est = o.postpr_est.boot();
137 if ~isempty(o.postpr_test)
138 o.postpr_test = o.postpr_test.boot();
145 % Checks whether the
sgs property is set, or else if the datasets property has two columns
146 if isempty(o.
sgs) && size(o.datasets, 2) < 2
147 irerror('If
sgs is not set, the data property must receive two datasets (train-test)!');
154 o.classtitle = 'using Classifier';
function irverbose(in s, in level)
Base Sub-dataset Generation Specification (SGS) class.
Group Aggregator - Classes - Vote.
Block that resolves estimato posterior probabilities into classes.
Pre-processing block base class.
Estimation logs base class.
Records (test class)x([rejected, estimation class]) hits.
function assert_decider(in obj)
FSG that uses classifier to grade the subsets.
FSG - Feature Subset Grader.
Group Aggregator - Classes - First row.
Cascade block: sequence of blocks represented by a block.