IRootLab
An Open-Source MATLAB toolbox for vibrational biospectroscopy
report_log_fselrepeater_histcomp.m
Go to the documentation of this file.
1 %> @brief Histograms and biomarkers comparison using various @ref subsetsprocessor objects
2 %>
3 %> Accessible from objtool, but not configurable at the moment (will use property defaults).
5  properties
6  %> Cell of subsetsprocessor objects
7  subsetsprocessors;
8  %> =def_peakdetector()
10  %> =def_biocomparer(). A @ref biocomparer object
12 
13  %> =1. Whether to plot the histograms
14  flag_plot_hists = 1;
15 
16  %> Hint dataset
17  ds_hint;
18  end;
19 
20  methods
22  o.classtitle = 'Comparison between SSPs';
23  o.inputclass = 'log_fselrepeater';
24  o.flag_params = 0;
25  o.flag_ui = 1;
26  end;
27  end;
28 
29  methods(Access=protected)
30  function out = do_use(o, log)
31  out = log_html();
32  s = ['<h1>', o.classtitle, '</h1>'];
33  out.html = [s, o.get_html_graphics(log)];
34  out.title = log.get_description();
35  end;
36  end;
37 
38 
39  methods
40  %> Generates a table with the best in each architecture, with its respective time and confidence interval
41  %> @param log a solog_merger_fhg object
42  function s = get_html_graphics(o, log)
43  s = '';
44  if isempty(o.subsetsprocessors)
45  ssps = def_subsetsprocessors();
46  else
47  ssps = o.subsetsprocessors;
48  end;
49  hists = o.get_hists(log, ssps);
50  n = numel(hists);
51 
52  if o.flag_plot_hists
53  figure;
54  log.draw_stackedhist_for_legend();
56  s = cat(2, s, o.save_n_close([], 0, []));
57 
58  %---> Histograms
59  for i = 1:n
60  hist = hists(i);
61  figure;
62  hist.draw_stackedhists(o.ds_hint, {[], .8*[1 1 1]}, def_peakdetector(o.peakdetector));
63  xlabel('');
64  ylabel('');
66 % % % % set(gca, 'color', 1.15*[0.8314 0.8157 0.7843]);
67  set(gca, 'Outerposition', [-0.1121 0.0502 1.2188 0.9498]);
68  legend off;
69  title(replace_underscores(hist.title));
70  maximize_window(gcf(), 4);
71 % % % % set(gcf, 'InvertHardCopy', 'off'); % This is apparently needed to preserve the gray background
72 % % % % set(gcf, 'color', [1, 1, 1]);
73  s = cat(2, s, o.save_n_close());
74  end;
75  end;
76 
77  %---> Biomarkers comparison table
78  bc = def_biocomparer(o.biocomparer);
79  s = cat(2, s, '<h2>Biomarkers comparison table of histograms above</h2>', 10); %bc.get_description(), '</h2>');
80  [M, titles] = o.get_biocomparisontable(hists);
81  s = cat(2, s, '<center>', html_table_std_colors(round(M*1000)/1000, [], titles, titles, '\', 0.5, 1, 4), '</center>', 10);
82 
83 
84  % Reports the objects used
85  s = cat(2, s, '<h2>Subsets processors used</h2>');
86  a = ssps;
87  for i = 1:numel(a)
88  obj = a{i};
89  s = cat(2, s, '<p><b>', obj.get_description, '</b></p>', 10, '<pre>', obj.get_report(), '</pre>', 10);
90  end;
91  s = cat(2, s, '<hr />', 10);
92 
93  end;
94 
95 
96  function hists = get_hists(o, log, ssps)
97  n = numel(ssps);
98  % Histograms
99  for i = 1:n
100  ssp = ssps{i};
101  hists(i) = ssp.use(log); %#ok<*AGROW>
102  hists(i).title = ssp.title;
103  end;
104  end;
105 
106 
107  %> Generates a matrix of item-wise Biomarkers Coherence Indexes
108  %>
109  %> @param hists array of log_hist
110  %>
111  %> @return [M, titles]
112  function [M, titles] = get_biocomparisontable(o, hists)
115 
116  n = numel(hists);
117  for i = 1:n
118  hist = hists(i);
119  pd = pd.boot(hist.fea_x, hist.grades);
120  % Collects biomarkers
121  pdidxs = pd.use([], hist.grades);
122  wnss{i} = hist.fea_x(pdidxs);
123  weightss{i} = hist.grades(pdidxs);
124  titles{i} = hist.title;
125  end;
126 
127  % + Mounts table
128  M = eye(n);
129  for i = 1:n
130  for j = i+1:n
131  [matches, index] = bc.go(wnss{i}, wnss{j}, weightss{i}, weightss{j}); %#ok<ASGLU>
132  M(i, j) = index;
133  M(j, i) = index;
134  end;
135  end;
136  end;
137 
138 
139  end;
140 
141  methods(Static)
142  function a = get_defaultsubsetsprocessors()
143  a = def_subsetsprocessors();
144  end
145  end;
146 end
Generated by subsetsprocessor, carries a histogram.
Definition: log_hist.m:2
function maximize_window(in h, in aspectratio, in normalizedsize)
function objtool(in varargin)
Histograms and biomarkers comparison using various subsetsprocessor objects.
Peak Detector.
Definition: peakdetector.m:6
function def_peakdetector(in out)
function show_legend_only()
function html_table_std_colors(in M, in S, in rowlabels, in collabels, in cornerstr, in minimum, in maximum, in pow)
Generated by fselrepeater, carries subsets of features.
function replace_underscores(in s)
Generated by irreport, carries HTML contents.
Definition: log_html.m:2
function def_subsetsprocessors()
function def_biocomparer(in out)
Processor of a set of subsets of features.
Base for all reports that operate on a soitem object.
Definition: report_soitem.m:2
function make_axis_gray()