1 %> @brief Base
class for Incremental Classifiers
3 %> These classifiers have a learning process that uses one data row at a time.
5 %> This
class introduced facilities to record the "learning curve" (evolution of the classifier performance
as it learns) of the classifier.
7 %> @note If the classifier is set to record, (i.e., flag_rtrecord is
true), it can only be trained once
12 %> =0. Whether to attempt to record the learning curve in RealTime (RT)
14 %> =1. Recording periodicity
17 %> (Optional) Block to post-process the test data. For example, a @ref
grag_classes_first.
19 %> Block to post-process the estimation issued by the classifier. Examples:
24 %> Test dataset, to be used only
if @ref flag_rtrecord is
true
27 %> Cell of @ref
ttlog objects
31 properties (SetAccess=
protected)
32 %> (number of elements in log_mold)x(number of elements in training set (see also @ref
clssr_incr::allocate()).
33 %> Learning curves recorded here
37 %> Restarting counter to know when to record (see @ref every)
39 %> Number of allocated recordings
41 %> Number of rows in the training set
43 %> Row index, incremented when record() is called
45 %> Whether recording has been allocated
51 o.classtitle = 'Incremental';
55 methods(Access=protected)
56 function o = do_boot(o)
58 % Checks if postpr_est is ok; boots the post-processors
59 if ~isempty(o.postpr_est)
60 o.postpr_est = o.postpr_est.boot();
62 if ~isempty(o.postpr_test)
63 o.postpr_test = o.postpr_test.boot();
77 %> Records one column of @ref
clssr_incr::rates
78 function o = record(o)
84 if o.i_row == o.no_rows || o.i_e >= o.record_every
90 irerror(sprintf('Number of allocated recordings is only %d, but wanted to record element
# %d!', o.nar, o.i_r));
93 est = o.use(o.data_test);
95 if ~isempty(o.postpr_est)
96 est = o.postpr_est.use(est);
98 if isempty(est.classes)
99 irerror('Estimation post-processing did not assign classes!');
102 if ~isempty(o.postpr_test)
103 ds_test = o.postpr_test.use(o.data_test);
105 ds_test = o.data_test;
108 pars = struct('est', {est},
'ds_test', {ds_test},
'clssr', {o});
110 for i = 1:numel(o.log_mold)
111 log = o.log_mold{i}.allocate(1);
112 log = log.record(pars);
113 o.rates(i, o.i_r) = log.get_rate();
122 %> Called every time train() is called
123 function o = allocate(o, n)
126 o.nar = o.get_no_recordings(n);
127 o.rates = zeros(numel(o.log_mold), o.nar);
128 o.flag_allocated = 1;
135 %> Returns number of recordings based on internal setup
137 %> returns <code>ceil(n/o.record_every)</code>
138 function nr = get_no_recordings(o, n)
139 nr = ceil(n/o.record_every);
Group Aggregator - Classes - Vote.
Base class for Incremental Classifiers.
Block that resolves estimato posterior probabilities into classes.
function allocate(in o, in n)
function assert_decider(in obj)
Group Aggregator - Classes - First row.
Analysis Session (AS) base class.
Cascade block: sequence of blocks represented by a block.