1 %> @brief Cross-calculation Analysis Session
3 %> Allows one to extract elements:
4 %> @arg The average loadings matrix
5 %> @arg Each individually trained
block and respective output dataset
7 %> Cross-calculation means calculating the output by means of
8 %> cross-validation. The idea is to generate the output in several parts,
9 %> where each part was generated by a
block trained with a dataset where
10 %> that part was not included.
12 %> This is related to the idea of Stacked Generalization [1]. See also [2]
13 %>
for a simple comprehensive text.
15 %> <h3>References</h3>
16 %> [1] Wolpert,
"Stacked Generalization", 1992.
18 %> [2] Kuncheva,
"Combining Pattern Classifiers", 2004, page 109.
21 %> (optional) SGS, preferrably a cross-validation (@ref
sgs_crossval).
23 %> This
property is optional. If not specified,
if will
default to a a Leave-One-Out Cross-validation with
sgs::flag_group = 1
29 properties (SetAccess=
protected)
31 %> This will be set at go() time and used subsequently to reorder
32 %> the classlabels of extracted dataset(s)
38 o.classtitle = 'Cross-Calculate';
43 methods(Access=protected)
44 %> Populates the @ref log_crossc and @ref data_out properties
46 function log = do_use(o, data)
49 irverbose('Creating default Leave-One-Out Cross-validation SGS...', 1);
50 sgs = sgs_crossval(); %
#ok<*PROP>
60 log.obsidxs = log.sgs.get_obsidxs(data);
61 no_reps = size(log.obsidxs, 1);
63 mold_ = o.mold.boot();
64 flag_linear = isa(mold_,
'fcon_linear') || isa(mold_,
'block_cascade_base') && mold_.flag_fcon_linear;
67 block_ref = mold_.train(data); % Trains the mold
block on the whole dataset to have its loadings
as a loadings orientation reference
73 d_train = data.map_rows(log.obsidxs{i_rep, 1});
74 d_test = data.map_rows(log.obsidxs{i_rep, 2});
79 if any(size(
block.L) ~= size(block_last.L))
80 s = ['Sorry, mate but blocks are giving different L sizes: ', mat2str([size(
block.L)]), ...
81 ' xxx ', mat2str(size(block_last.L)), '. Try limiting the number of loadings to ', ...
82 min(size(
block.L, 2), size(block_last.L, 2))];
89 % Inserts a blok at the end
94 block = block.train(d_train); % Trains again, who cares
101 log.data_out = block.use(d_test);
103 log.data_out(i_rep) = block.use(d_test);
106 log.blocks{i_rep} = block;
116 log.classlabels = data.classlabels;
Property flag_perclass
=0. Whether to perform on each class separately.
function irverbose(in s, in level)
Feature Construction - Linear Transformations base class.
Base Sub-dataset Generation Specification (SGS) class.
function progress2_change(in prgrss, in title, in perc, in i, in n)
Property flag_group
=0. Whether items from the same group (group) are to always remain together.
function progress2_open(in title, in perc, in i, in n)
Log generated by an as_crossc.
function make_one(in cob)
function boot(in o)
Configures the structure to deal with new type of data.
Cross-calculation Analysis Session.
function progress2_close(in prgrss)
Analysis Session (AS) base class.
function adjust_turn2(in b, in bref)
function train(in o, in data, in varargin)
Trains block.