This class implements an instance for multi-class classification. An instance for multi-class classification consists of an attribute vector (implemented by attributes_tmpl) and a label index (implemented in this class). In addition, an instance class exposes the interfaces for instance weighting (implemented by weight_tmpl) and instance group numbers (implemented by group_tmpl).
attributes_tmpl | The type of an attribute vector. | |
weight_tmpl | The base class implementing instance weighting. By default, this class uses weight_base. | |
group_tmpl | The base class implementing group numbers. By default, this class uses group_base. |
Public Types | |
typedef attributes_tmpl | attributes_type |
The type of an attribute vector. | |
typedef attributes_type::identifier_type | attribute_type |
The type of an attribute identifier. | |
typedef attributes_type::value_type | value_type |
The type of an attribute value. | |
Public Member Functions | |
multi_instance_base () | |
Constructs an object. | |
virtual | ~multi_instance_base () |
Destructs an object. | |
void | set_label (int i) |
Sets the label. | |
int | get_label () const |
Gets the label. | |
int | num_candidates (const int L) const |
Returns the number of possible candidate labels that can be assigned. | |
const attributes_type & | attributes (int i) const |
Returns a read-only access to the attribute vector. | |
attributes_type & | attributes (int i) |
Returns an access to the attribute vector. | |
Protected Attributes | |
int | m_index |
The candidate index of this instance. |
void classias::multi_instance_base< attributes_tmpl, weight_tmpl, group_tmpl >::set_label | ( | int | i | ) | [inline] |
Sets the label.
i | The label index. |
int classias::multi_instance_base< attributes_tmpl, weight_tmpl, group_tmpl >::get_label | ( | ) | const [inline] |
Gets the label.
int classias::multi_instance_base< attributes_tmpl, weight_tmpl, group_tmpl >::num_candidates | ( | const int | L | ) | const [inline] |
Returns the number of possible candidate labels that can be assigned.
In multi-class classification, the number of possible labels does not depend on each instance but only on the total number of labels that is global to the data set. Thus, this function is meaningless in terms of the functionality, but necessary for the compatibility with candidate instances (candidate_instance_base), which have variable numbers of candidates.
L | The total number of labels in the dataset. |
const attributes_type& classias::multi_instance_base< attributes_tmpl, weight_tmpl, group_tmpl >::attributes | ( | int | i | ) | const [inline] |
Returns a read-only access to the attribute vector.
i | Reserved only for the compatibility with candidate_instance_base class. |
attributes_type& classias::multi_instance_base< attributes_tmpl, weight_tmpl, group_tmpl >::attributes | ( | int | i | ) | [inline] |
Returns an access to the attribute vector.
i | Reserved only for the compatibility with candidate_instance_base class. |