IRootLab
An Open-Source MATLAB toolbox for vibrational biospectroscopy
log_as_fsel_grades.m
Go to the documentation of this file.
1 %> @brief Log generated by as_fsel_grades
3  properties
4  %> Optimization sub-sets
5  opt_subsets;
6  %> Optimization grades
7  opt_grades;
8  %> Whether the selected features are peaks
9  flag_peaks;
10  %>
11  type;
12  %>
13  threshold;
14  end;
15 
16  methods
17  function o = log_as_fsel_grades()
18  o.classtitle = 'Grades';
19  o.moreactions = [o.moreactions, {'extract_dataset'}];
20  o.flag_ui = 0;
21  end;
22 
23  %> Creates a dataset with one row containing the @ref opt_grades property.
24  %>
25  %> @sa as_fsel_grades
26  function out = extract_dataset(o)
27  if isempty(o.opt_subsets)
28  irerror('Object contains no information about optimization of number of features');
29  end;
30 
31  out = irdata();
32  out.X = o.opt_grades(:)'; % row vector
33  out.classes = 0;
34  out.classlabels = {o.yunit};
35  out.fea_x = 1:numel(o.opt_grades);
36  out.xname = 'Number of features';
37  out.xunit = '';
38  out.yname = o.yname;
39  out.yunit = o.yunit;
40  out.title = 'Optimization of number of features';
41  out = out.assert_fix();
42  end;
43  end;
44 
45  %>>>>>> DRAWING
46  methods
47  %> Enhancements from ancestor @ref log_as_fsel_grades
48  %>
49  %> @arg Draws threshold line
50  %> @arg Draws hachures only if threshold mode
51  %> @arg Draws peaks
52  function o = draw(o, data_hint, flag_mark)
53  if ~exist('data_hint', 'var')
54  data_hint = [];
55  end;
56 
57  if ~exist('flag_mark', 'var')
58  flag_mark = 0;
59  end;
60 
61  o.draw_hachures2();
62  o.draw_grades(data_hint, 0);
63 
64  o.draw_threshold();
65  if flag_mark
66  if o.flag_peaks
67  o.draw_peaks();
68  else
69  o.draw_markers();
70  end;
71  end;
72  o.draw_finish();
73  end;
74  end;
75 
76  methods(Access=protected)
77  %> Checks for existence of Inf's and calculates ymax automatically
78  function o = draw_hachures2(o)
79  if strcmp(o.type, 'threshold')
80  g = o.grades;
81  g(g == Inf) = [];
82  ymax = max(g)*1.05;
83  o.draw_hachures(o.fea_x, ymax);
84  end;
85  end;
86 
87  function o = draw_threshold(o)
88  if strcmp(o.type, 'threshold')
89  draw_threshold_line(o.fea_x, o.threshold);
90  end;
91  end;
92 
93  function o = draw_peaks(o)
94  flag_text = 1;
95  draw_peaks(o.fea_x, o.grades, o.v, flag_text);
96  end;
97  end;
98 end
function draw_peaks(in x, in y, in indexes, in flag_text, in color, in marker, in markersize)
function irerror(in s)
Dataset class.
Definition: irdata.m:30
Property yunit
y-axis unit, defaults to 'a.u.'
Definition: irdata.m:93
Log generated by an as_fsel class.
Definition: log_as_fsel.m:2
function draw_threshold_line(in x, in y, in width, in color)
Property flag_ui
(GUI setting) Whether to "publish" in blockmenu and datatool. Note that a class can be "published" wi...
Definition: irobj.m:60
Log generated by as_fsel_grades.
Feature Selection based on a "grades" vector.