This feature generator assigns a feature for every combination of attributes and labels. The number of features is the number of attributes multiplied by the number of labels. A conversion between attribute-label space and feature space is faster than sparse_feature_generator_base, but feature space will be large. Call regist() function to register a pair of an attribute and feature.
attribute_tmpl | The type of an attribute. | |
label_tmpl | The type of a label. | |
feature_tmpl | The type of a feature. |
Public Types | |
typedef attribute_tmpl | attribute_type |
The type of an attribute. | |
typedef label_tmpl | label_type |
The type of a label. | |
typedef feature_tmpl | feature_type |
The type of a feature. | |
Public Member Functions | |
dense_feature_generator_base () | |
Constructs an object. | |
virtual | ~dense_feature_generator_base () |
Destructs an object. | |
const char * | name () const |
Returns the name of the feature generator. | |
size_t | num_labels () const |
Returns the total number of labels. | |
size_t | num_attributes () const |
Returns the total number of attributes. | |
size_t | num_features () const |
Returns the total number of features. | |
void | set_num_attributes (size_t num_attributes) |
Sets the total number of attributes. | |
void | set_num_labels (size_t num_labels) |
Sets the total number of labels. | |
bool | needs_registration () const |
Returns if this class requires registration. | |
feature_type | regist (const attribute_type &a, const label_type &l) |
Registers an association between an attribute and label. | |
bool | forward (const attribute_type &a, const label_type &l, feature_type &f) const |
Returns the feature associated with a pair of an attribute and label. | |
bool | backward (const feature_type &f, attribute_type &a, label_type &l) const |
Returns the attribute and label associated with a feature. | |
Protected Attributes | |
size_t | m_num_labels |
The total number of labels. | |
size_t | m_num_attributes |
The total number of attributes. |
const char* classias::dense_feature_generator_base< attribute_tmpl, label_tmpl, feature_tmpl >::name | ( | ) | const [inline] |
Returns the name of the feature generator.
size_t classias::dense_feature_generator_base< attribute_tmpl, label_tmpl, feature_tmpl >::num_labels | ( | ) | const [inline] |
Returns the total number of labels.
size_t classias::dense_feature_generator_base< attribute_tmpl, label_tmpl, feature_tmpl >::num_attributes | ( | ) | const [inline] |
Returns the total number of attributes.
size_t classias::dense_feature_generator_base< attribute_tmpl, label_tmpl, feature_tmpl >::num_features | ( | ) | const [inline] |
Returns the total number of features.
void classias::dense_feature_generator_base< attribute_tmpl, label_tmpl, feature_tmpl >::set_num_attributes | ( | size_t | num_attributes | ) | [inline] |
Sets the total number of attributes.
num_attributes | The total number of attributes. |
void classias::dense_feature_generator_base< attribute_tmpl, label_tmpl, feature_tmpl >::set_num_labels | ( | size_t | num_labels | ) | [inline] |
Sets the total number of labels.
num_labels | The total number of labels. |
bool classias::dense_feature_generator_base< attribute_tmpl, label_tmpl, feature_tmpl >::needs_registration | ( | ) | const [inline] |
Returns if this class requires registration.
false
. feature_type classias::dense_feature_generator_base< attribute_tmpl, label_tmpl, feature_tmpl >::regist | ( | const attribute_type & | a, | |
const label_type & | l | |||
) | [inline] |
Registers an association between an attribute and label.
a | The attribute. | |
l | The label. |
bool classias::dense_feature_generator_base< attribute_tmpl, label_tmpl, feature_tmpl >::forward | ( | const attribute_type & | a, | |
const label_type & | l, | |||
feature_type & | f | |||
) | const [inline] |
Returns the feature associated with a pair of an attribute and label.
a | The attribute. | |
l | The label. | |
f | The feature for the attribute and label, which is always identical to the attribute. |
true
if the pair of the attribute and label is successfully mapped to a feature, which is always true
. bool classias::dense_feature_generator_base< attribute_tmpl, label_tmpl, feature_tmpl >::backward | ( | const feature_type & | f, | |
attribute_type & | a, | |||
label_type & | l | |||
) | const [inline] |
Returns the attribute and label associated with a feature.
f | The feature. | |
a | The attribute associated with the feature. | |
l | The label associated with the feature. |
if
the feature is successfully associated with the attribute and label.