IRootLab
An Open-Source MATLAB toolbox for vibrational biospectroscopy

Detailed Description

Class labels hierarchy resolver.

This function parses a list of multi-level class labels, essentially finding the individual labels between the '|' separators.

It also mounts new class labels and gives their corresponding new class numbers, if the 'new_hierarchy' input is passed.

Everything is returned in a 2D cell that contains one row for each class label. The meanings of the cell columns are as follows:

  • Column 1: original class numbers, actually just a zero-based increasing counter
  • Column 2: the original class labels, in the same order as in 'classlabels'
  • Column 3: new class labels according to the class levels to be retained
  • Column 4: new class numbers according to new hierarchy
  • Columns 5, 6, 7 ...: parsed individual labels per level. The number of columns in the cell will be thus 4+no_levels

Example:

/// >> c = {'A|1|T', 'A|1|F', 'A|2|T', 'A|2|F', 'A|3|T', 'A|3|F', 'B|1|T', 'B|1|F'};
/// >> cc = classlabels2cell(c, [1, 3])
/// 
/// cc = 
/// 
///     [0]    'A|1|T'    'A|T'    [1]    'A'    '1'    'T'
///     [1]    'A|1|F'    'A|F'    [0]    'A'    '1'    'F'
///     [2]    'A|2|T'    'A|T'    [1]    'A'    '2'    'T'
///     [3]    'A|2|F'    'A|F'    [0]    'A'    '2'    'F'
///     [4]    'A|3|T'    'A|T'    [1]    'A'    '3'    'T'
///     [5]    'A|3|F'    'A|F'    [0]    'A'    '3'    'F'
///     [6]    'B|1|T'    'B|T'    [3]    'B'    '1'    'T'
///     [7]    'B|1|F'    'B|F'    [2]    'B'    '1'    'F'
/// 
@sa cell2classlabels.m  

Definition in file classlabels2cell.m.

Go to the source code of this file.

Functions

function classlabels2cell (in classlabels, in new_hierarchy)
 

Function Documentation

function classlabels2cell ( in  classlabels,
in  new_hierarchy 
)
Parameters
classlabels
new_hierarchy=[]. New hierarchy. 0 means "none"; [] means "all"
Returns
cc