1 %> @brief Histograms ane Biomarkers comparison tables - Several set-ups (including stabilizations). Comparisons
using histograms, biomarker comparison tables/(heat maps).
10 %> Cell of subsetsprocessors to perform biomarkers comparisons
using different subsetsprocessors. If used, the comparison will be per stab
11 %> Note that
this property does not have a corresponding GUI input at the moment.
15 flag_draw_histograms = 1;
16 flag_draw_stability = 1;
18 flag_biocomp_per_clssr = 1;
19 flag_biocomp_per_stab = 1;
22 flag_biocomp_per_ssp = 1;
24 %> =10. Stabilization number to be used in the
"all" comparison
27 %> Whether to generate a table where the varying element will be the nf4grades of a fixed-nf4grades
subsetsprocessor
28 flag_biocomp_nf4grades = 1;
33 o.classtitle = 'Several comparisons'; %Histograms and biomarkers comparison tables';
34 o.inputclass = 'soitem_merger_fhg';
39 methods(Access=protected)
40 function out = do_use(o, item)
42 if o. flag_biocomp_per_clssr || o.flag_biocomp_per_stab || o.flag_biocomp_all || o.flag_nf4grades
46 s = o.get_standardheader(item);
48 out.html = [s, o.get_html_graphics(item)];
49 out.title = item.get_description();
55 %> Generates a table with the best in each architecture, with its respective time and confidence interval
56 %> @param item a soitem_merger_fhg
object
57 function s = get_html_graphics(o, item)
65 if o.flag_biocomp_per_clssr
66 % Finds out setups with more than one variation ("stabilizations")
67 groupidxs = item.find_methodologygroups();
71 % Giving no message at the moment
73 s = cat(2, s, '<h1>Stabilization comparison grouped by FHG-classifier setup</h1>', 10);
74 % Generates sub-reports for these groups separately
76 if i > 1; s = cat(2, s, '<hr />', 10); end;
77 s = cat(2, s, sprintf('<h2>FHG setup: "%s"</h2>\n', item.s_methodologies{groupidxs{i}(1)}), o.get_html_from_logs(item, groupidxs{i}));
80 s = cat(2, s,
'<h2>FHG setups table merge</h2>', item.html_biocomparisontable_stab(ssp, pd, bc));
82 s = cat(2, s,
'<hr />', 10); % All sections divided by
double HR
83 s = cat(2, s,
'<hr />', 10);
87 if o.flag_biocomp_per_stab
88 s = cat(2, s,
'<h1>FHG setup comparison grouped by stabilization</h1>', 10);
89 stabs = unique(item.stabs);
90 for i = 1:numel(stabs)
91 s = cat(2, s, sprintf(
'<h2>Stabilization: "%d"</h2>\n', stabs(i)), o.get_html_from_logs(item, item.find_stab(stabs(i))));
93 s = cat(2, s,
'<hr />', 10);
94 s = cat(2, s,
'<hr />', 10);
98 % Picks one representant from each group
99 idxs = [item.find_stab(o.get_stab4all(item))]; %; item.find_stab(20)];
100 idxs = idxs(:)
'; % makes 10, 20, 10, 20, ...
101 idxs = [idxs, item.find_single()];
102 s = cat(2, s, '<h1>Comparison of all setups</h1>
', 10, ...
103 '<p>In
this section, FHG-classifier setups will use stabilization=<b>
', int2str(o.get_stab4all(item)), '</b></p>
', 10, ...
104 o.get_html_from_logs(item, idxs));
105 % Generates one report for comparison among ALL different methodologies
106 s = cat(2, s, '<hr />
', 10);
107 s = cat(2, s, '<hr />
', 10);
111 if o.flag_biocomp_nf4grades
112 ssp = def_subsetsprocessor(o.subsetsprocessor);
113 s = cat(2, s, '<h1>Comparison of number of selected features grouped per stabilization</h1>
', 10, ...
114 '<p>Number of selected features varying from 1 to <b>
', int2str(item.logs(1).nfmax), '</b></p>
', 10, ...
115 '<p>Only the FHG-classifier setups are compared in
this section. Each stabilization
case summarizes all FHG-classifier set-ups.</p>
', 10, ...
116 '<p>Base subsets processor used in
this section (from which nf4grades will vary):<br>
' , 10, ...
117 '<
pre>
', ssp.get_report(), '</
pre></p>
', 10);
120 stabs = unique(item.stabs);
121 stabs(stabs < 0) = [];
123 s = cat(2, s, '<p><font color=red>Comparison of number of selected features available
for FHG-classifier set-ups (with stabilization) only.</font></p>
');
125 for i = 1:numel(stabs)
126 s = cat(2, s, sprintf('<h2>Stabilization: %02d</h2>\n
', stabs(i)));
127 s = cat(2, s, o.get_html_biocomp_nf4grades(item, item.find_stab(stabs(i)), ssp));
130 s = cat(2, s, sprintf('<h2>Stabilizations: all</h2>\n
'));
131 s = cat(2, s, o.get_html_biocomp_nf4grades(item, find(item.stabs >= 0), ssp)); %#ok<FNDSB>
133 s = cat(2, s, '<hr />
', 10);
134 s = cat(2, s, '<hr />
', 10);
137 if o.flag_biocomp_per_ssp
139 s = cat(2, s, '<h1>Comparison of subsets processors</h1>
', 10);
141 stabs = unique(item.stabs);
142 stabs(stabs < 0) = [];
144 s = cat(2, s, '<p><font color=red>Comparison of subsets processors available
for FHG-classifier setups (with stabilization) only</font></p>
');
146 for i = 1:numel(stabs)
147 s = cat(2, s, sprintf('<h2>Stabilization: %02d</h2>\n
', stabs(i)));
148 s = cat(2, s, o.get_html_biocomp_ssps(item, item.find_stab(stabs(i)), ssps));
151 s = cat(2, s, sprintf('<h2>Stabilization: all</h2>\n
'));
152 s = cat(2, s, o.get_html_biocomp_ssps(item, find(item.stabs >= 0), ssps)); %#ok<FNDSB>
156 % Reports the objects used
157 s = cat(2, s, '<h2>Subsets processors used in
this section</h2>
');
161 s = cat(2, s, '<p><b>
', obj.get_description, '</b></p>
', 10, '<
pre>
', obj.get_report(), '</
pre>
', 10);
164 s = cat(2, s, '<hr />
', 10);
165 s = cat(2, s, '<hr />
', 10);
169 % Average stability curves
170 if o.flag_draw_stability
171 idxs = find(item.stabs >= 0);
174 s = cat(2, s, '<p><font color=red>Average stability curve per stabilization available
for methodologies with stabilization only</font></p>
');
177 log_rep = item.logs(idxs(i));
178 ds_stab(i) = log_rep.extract_dataset_stabilities(); %#ok<AGROW>
179 ds_stab(i).classlabels = {sprintf('stab%02d
', item.stabs(idxs(i)))}; %#ok<AGROW>
181 ds = o.merge_ds_stab(ds_stab);
185 maximize_window([], 1.8);
186 s = cat(2, s, '<h1>Average stability curve per stabilization</h1>
', 10);
187 s = cat(2, s, o.save_n_close([], 0));
189 s = cat(2, s, '<hr />
', 10);
190 s = cat(2, s, '<hr />
', 10);
194 %-----> nf for grades table
195 s = cat(2, s, '<h1>Number of informative features table</h1>
', 10, ...
196 '<p>These numbers will only vary
if the base subsetsprocessor provided nas nf4gradesmode=
''stability
''.</p>
', 10, ...
197 o.get_html_nf4grades(item, 1:numel(item.logs)));
198 s = cat(2, s, '<hr />
', 10);
199 s = cat(2, s, '<hr />
', 10);
202 % Reports the objects used
203 s = cat(2, s, '<h1>Properties of some objects used</h1>
');
207 s = cat(2, s, '<p><b>
', obj.get_description, '</b></p>
', 10, '<
pre>
', obj.get_report(), '</
pre>
', 10);
209 s = cat(2, s, '<hr />
', 10);
210 s = cat(2, s, '<hr />
', 10);
214 function s = get_html_biocomp_nf4grades(o, item, idxs, ssp)
216 [temp, M, titles] = item.html_biocomparisontable_nf4grades(idxs, ssp, o.peakdetector, o.biocomparer);
219 % Draws as image as well, easier to perceive
223 xtick = 1:size(M, 1);
224 set(gca(), 'xtick
', xtick, 'ytick
', xtick, 'xticklabel
', titles, 'yticklabel
', titles);
226 format_frank([], [], hcb);
227 s = cat(2, s, o.save_n_close([], 0));
230 function s = get_html_biocomp_ssps(o, item, idxs, ssps)
232 [temp, M, titles] = item.html_biocomparisontable_ssps(idxs, ssps, o.peakdetector, o.biocomparer); %#ok<NASGU,ASGLU>
234 aa = arrayfun(@int2str, 1:numel(titles), 'UniformOutput
', 0); % Makes ticks 1, 2, 3 ... because titles are too long
236 % Draws as image as well, easier to perceive
240 xtick = 1:size(M, 1);
241 set(gca(), 'xtick
', xtick, 'ytick
', xtick, 'xticklabel
', aa, 'yticklabel
', aa);
243 format_frank([], [], hcb);
244 s = cat(2, s, o.save_n_close([], 0));
249 function s = get_html_from_logs(o, item, idxs)
251 ssp = def_subsetsprocessor(o.subsetsprocessor);
254 if o.flag_draw_histograms
255 s = cat(2, s, '<h3>Histograms</h3>
', 10);
258 log_rep = item.logs(idxs(1));
260 log_rep.draw_stackedhist_for_legend();
262 s = cat(2, s, o.save_n_close([], 0, []));
263 v = vis_stackedhists();
264 v.data_hint = []; % Could have a o.data_hint;
265 v.peakdetector = def_peakdetector(o.peakdetector);
270 log_rep = item.logs(idxs(i));
271 if o.flag_draw_histograms
272 hist = ssp.use(log_rep);
277 % Will occupy 70% of screen width, and render the IMG tag without size specification
278 maximize_window(gcf(), 4, .7);
279 s = cat(2, s, '<h3>
', item.get_logdescription(idxs(i)), '</h3>
', o.save_n_close([], 0));
282 if o.flag_draw_stability
284 ds_stab(i) = log_rep.extract_dataset_stabilities(); %#ok<AGROW>
285 ds_stab(i).classlabels = {replace_underscores(sprintf('%s stab%02d
', item.s_methodologies{idxs(i)}, item.stabs(idxs(i))))}; %#ok<AGROW>
290 % ds = o.merge_ds_stab(ds_stab);
291 % ov = vis_alldata();
292 if o.flag_draw_stability
293 for j = 1:2 % 1 pass for the legend, second for the graphics
296 plot(ds_stab(i).fea_x, ds_stab(i).X, 'Color
', find_color(i), 'LineWidth
', scaled(2)); % 'LineStyle
', find_linestyle(i),
299 format_xaxis(ds_stab(1));
300 format_yaxis(ds_stab(1));
301 set(gca, 'xlim
', get(gca, 'xlim
'), 'ylim
', get(gca, 'ylim
')); % Just to switch to manual mode
305 legend(cat(2, ds_stab.classlabels));
311 s = cat(2, s, o.save_n_close([], 0));
316 % Biomarkers coherence tables
317 s = cat(2, s, '<h3>Biomarkers coherence</h3>
', 10, item.html_biocomparisontable(idxs, ssp, o.peakdetector, o.biocomparer));
322 function s = get_html_nf4grades(o, item, idxs)
323 ssp = def_subsetsprocessor(o.subsetsprocessor);
324 s = item.html_nf4grades(idxs, ssp);
330 function ssps = get_ssps(o)
331 if isempty(o.subsetsprocessors)
332 ssps = report_log_fselrepeater_histcomp.get_defaultsubsetsprocessors();
334 ssps = o.subsetsprocessors;
338 %> Because o.stab4all may be out of the chart
339 %> If o.stab4all was not practiced, will return maximum
340 %> stabilization used.
341 function n = get_stab4all(o, item)
342 if any(item.stabs == o.stab4all)
350 methods(Access=protected)
351 %> Merges datasets but first makes sure they all have same number of features
352 function ds = merge_ds_stab(o, daa) %#ok<MANU>
357 [ro, co] = size(temp);
358 daa(i).X = NaN(ro, nf);
359 daa(i).X(1:ro, 1:co) = temp;
361 daa(i) = daa(i).assert_fix(); % just in case
364 ds = data_merge_rows(daa);
Histograms ane Biomarkers comparison tables - Several set-ups (including stabilizations). Comparisons using histograms, biomarker comparison tables/(heat maps).
Pre-processing block base class.
function def_peakdetector(in out)
Generated by irreport, carries HTML contents.
function def_subsetsprocessor(in out)
static function get_defaultsubsetsprocessors()
function def_biocomparer(in out)
Processor of a set of subsets of features.
Base for all reports that operate on a soitem object.