IRootLab
An Open-Source MATLAB toolbox for vibrational biospectroscopy
ttlog.m
Go to the documentation of this file.
1 %> @brief Train-Test Log.
2 %>
3 %> Base class for objects that have the record(pars) method. Pars may contain a reference dataset; an estimation dataset; a block; ...
4 classdef ttlog < irlog
5  properties
6  %> =1. Whether to increment time whenever something is recorded
7  flag_inc_t = 1;
8  end;
9 
10  properties(SetAccess=protected)
11  %> Whether @c allocate() has been called.
12  flag_allocated = 0;
13  %> Number of allocated slots (call to allocate())
14  no_slots = 0;
15  end;
16 
17  methods(Access=protected) %, Abstract)
18  %> Abstract. Called to pre-allocate matrices. Must be called only when @c collabels and @c rowlabels can be resolved
19  %> (reaching this varies along @c ttlog descendants).
20  function o = do_allocate(o, tt)
21  end;
22  end;
23 
24  properties %(SetAccess=protected)
25  %> "Time", incremented every time @c record() is called. Reset to zero if @c allocate() is called.
26  t = 0;
27  end;
28 
29 
30  methods
31  function o = ttlog(o)
32  o.classtitle = 'Train-Test';
33  o.flag_params = 0;
34  o.moreactions{end+1} = 'extract_datasets';
35  end;
36 
37  %> @param pars Structure with varying fields: @c .ds_test ; %c .est ; @c .clssr .
38  function o = record(o, pars) %#ok<*INUSD>
39  end;
40 
41  %> Called to pre-allocate matrices after @c classlabels and @c rowlabels are set
42  function o = allocate(o, tt)
43 % fprintf('Chamando o allocate, sim\n');
44  o.t = 0;
45  o = o.do_allocate(tt);
46  o.flag_allocated = 1;
47  o.no_slots = tt;
48  end;
49 
50  %> Abstract.
51  function s = get_insane_html(o, pars)
52  s = '';
53  end;
54 
55  %> Abstract. Generates one dataset per row, containing percentages.
56  function dd = extract_datasets(o)
57  dd = [];
58  end;
59 
60  %> Returns the default "Rate" string. Note that the @c title property can be used.
61  function z = get_legend(o)
62  if ~isempty(o.title)
63  z = o.title;
64  else
65  z = 'Rate';
66  end;
67  end;
68 
69  %> Returns the "default" peformance measure, to be customizable. It is "abstract" in this class (returns zero)
70  %>
71  %> Note that "rate" is defined in the range 0-100, not 0-1
72  function z = get_rate(o)
73  z = 0;
74  end;
75 
76 
77  %> Returns the unit corresponding to what it returns as rate
78  function z = get_unit(o)
79  z = 'a.u.';
80  end;
81 
82  %> Returns format for sprintf()
83  function z = get_format(o)
84  z = '%f';
85  end;
86  end;
87 end
Pre-processing block base class.
Definition: pre.m:2
Base Block class.
Definition: block.m:2
Analysis Session (AS) base class.
Definition: as.m:6
Log base class.
Definition: irlog.m:5
Train-Test Log.
Definition: ttlog.m:4