1 %>@brief Different ways to use per-spectrum prediction aggregation (
grag), and decision thresholds (
decider)
5 %> Generates 4 situations: 2 datasets x 2 analyses
7 %> <h3>Datasets (she5trays.mat)</h3>
9 %> <li>Chemicals (
class level 1)</li>
10 %> <li>Non-transformed/transformed (
class level 2)</li>
16 %> <li>Classifier output is post-processed through <b>grag_classes_mean ->
decider</b></li>
18 %> In the first
case, the
decider selects which spectra will be allowed to vote, whereas
19 %> in the second
case, the posterior probabilities (supports) per spectrum are averaged before the
decider accepts or rejects a single per-group prediction.
25 u.decisionthreshold = 0;
32 grag_classes_vote01 = u;
36 u.flag_use_priors = 0;
39 % Classifier+post-processor for first analysis
41 u.blocks = {clssr_d01, decider01, grag_classes_vote01};
44 % Classifier+post-processor
for second analysis
46 u.blocks = {clssr_d01, grag_mean01, decider01};
60 u.sgs = sgs_crossval01;
62 u.postpr_test = grag_mean01;
74 u.blocks{2}.hierarchy = i_data;
76 cascade_stdhie01 = cascade_stdhie01.boot();
77 out = cascade_stdhie01.use(ds);
82 logs = tt.get_ttlogs(ds_stdhie01);
84 lo.estlabels = ds_stdhie01.classlabels;
85 lo.idx_rate = 1; % Rejected
86 lo.title =
'rejected';
91 gridsearch01.clssr =
iif(i_ana == 1, block_cascade01, block_cascade02);
92 gridsearch01.paramspecs = {sprintf(
'blocks{%d}.decisionthreshold',
iif(i_ana == 1, 2, 3)), 0:.05:.95, 0}; % 2 or 3 is the position of the
decider in the sequence inside the
block_cascade
93 gridsearch01.log_mold = logs;
94 out = gridsearch01.
use(ds_stdhie01);
95 log_gridsearch_gridsearch01 = out;
99 out = log_gridsearch_gridsearch01.extract_sovaluess();
104 u.dimspec = {[0 0], [1 2]};
105 u.valuesfieldname =
'rates';
106 blbl_extract_ds_from_sovalues01 = u;
107 out = blbl_extract_ds_from_sovalues01.use(sov);
108 sov_sovalues01 = out;
111 u.dimspec = {[0 0], [1 2]};
112 u.valuesfieldname =
'rejected';
113 blbl_extract_ds_from_sovalues02 = u;
114 out = blbl_extract_ds_from_sovalues02.use(sov);
115 sov_sovalues02 = out;
123 vis_hachures01.use(sov_sovalues01);
124 title(sprintf(
'Classes (%d): %s; Post-processor: %s --- (decision threshold) x (%%rate)', ds_stdhie01.nc, ...
125 iif(i_data == 1,
'Chemicals',
'N/T'),
replace_underscores([
class(gridsearch01.clssr.blocks{2}),
'->',
class(gridsearch01.clssr.blocks{3})])));
130 vis_hachures01.use(sov_sovalues02);
131 ylabel(
'Rejected (%)');
132 title(
'(decision threshold) x (%rejected)');
136 save_as_png([], sprintf(
'irr_dataset%02d_analysis%02d', i_data, i_ana));
Cascade block: final instantializable class.
Group Aggregator - Classes - Vote.
Linear and Quadratic discriminant.
function maximize_window(in h, in aspectratio, in normalizedsize)
Block that resolves estimato posterior probabilities into classes.
function use(in o, in data)
Applies block to data.
Hachures showing intervals.
Group Aggregator - combines data rows outputting one row per group.
Records (1)x([rejected, right, wrong]) hits.
function save_as_png(in h, in fn, in dpi)
Group Aggregator - averages rows per group.
function iif(in cond, in x1, in x2)
function replace_underscores(in s)
Demo cascade block: pre_norm_std -> blmisc_classlabels_hierarchy.
function load_data_she5trays()