IRootLab
An Open-Source MATLAB toolbox for vibrational biospectroscopy
as_dsperc_x_rate.m
Go to the documentation of this file.
1 %> @brief (dataset %) x (classification rate) curve
2 %>
3 %> @ingroup as needsrevision
4 %>
5 %> Runs a repeated sub-sampling loop for a given percentual with recording each generated @ref ttlog. Then,
6 %> Increases this percentual, runs the cross-validation loop again, and so on.
7 %>
8 %> @sa uip_dsperc_x_rate.m
9 classdef as_dsperc_x_rate < as
10  properties
11  %> reptt_blockcube object to do the evaluation
12  %> Note that only the first element of evaluator's @c log_mold will have effect. The others will be reset (if any).
13  evaluator;
14  %> =.1:.1:.9. Sequence of percentages for training
15  percs_train = .1:.1:.9;;
16  %> = .1. Percentage for testing. Note that <code>prect_test + percs_train(end)</code> should not exceed 1 (100%)
17  perc_test = .1;
18 
19  end;
20 
21  methods
22  function o = as_dsperc_x_rate(o)
23  o.classtitle = '(dataset%)x(performance) curve';
24  o.flag_ui = 0; % Not published in GUI
25  end;
26  end;
27 
28  methods(Access=protected)
29  function log = do_use(o, data)
30  if ~isa(o.evaluator, 'reptt_blockcube')
31  irerror('Evaluator must be a reptt_blockcube!');
32  end;
33  if ~isa(o.evaluator.sgs, 'sgs_randsub')
34  irerror('Evaluator''s SGS must be a sgs_randsub!');
35  end;
36  if strcmp(o.evaluator.sgs.type, 'fixed')
37  irerror('Evaluator''s SGS''s type cannot be ''fixed''!');
38  end;
39 
40  o.evaluator.log_mold = o.evaluator.log_mold(1); % Resets evaluator's log_mold to its first element.
41 
42  npercs = numel(o.percs_train);
43  nclssr = numel(o.evaluator.block_mold);
44 
45  log = log_celldata();
46  log.celldata = cell(nclssr, npercs);
47 
48  for iperc = 1:npercs
49  o.evaluator.sgs.bites = [o.percs_train(iperc), o.perc_test];
50  log_cube = o.evaluator.use(data);
51  log.celldata(:, iperc) = cellfun(@(x) (x.get_rates()), log_cube.logs, 'UniformOutput', 0);
52  end;
53 
54  log.fea_x = o.percs_train*100;
55  log.xname = 'Percent of dataset used in training';
56  log.xunit = '%';
57  log.yname = 'Classification rate';
58  log.yunit = '%';
59  log.rownames = cellfun(@(x) x.get_description(), o.evaluator.block_mold(:)', 'UniformOutput', 0);
60  end;
61  end;
62 end
Base Sub-dataset Generation Specification (SGS) class.
Definition: sgs.m:6
Log generated by a reptt_blockcube.
Definition: log_cube.m:9
function irerror(in s)
Random Sub-sampling.
Definition: sgs_randsub.m:5
Analysis Session (AS) base class.
Definition: as.m:6
(dataset %) x (classification rate) curve
REpeated Train-Test - Block Cube.
Train-Test Log.
Definition: ttlog.m:4
Learning curve: (percent dataset used for training)x(classification rate)
Definition: log_celldata.m:10