classias::dense_feature_generator_base< attribute_tmpl, label_tmpl, feature_tmpl > Class Template Reference


Detailed Description

template<class attribute_tmpl, class label_tmpl, class feature_tmpl>
class classias::dense_feature_generator_base< attribute_tmpl, label_tmpl, feature_tmpl >

A template class for feature generators for any combinations of attributes and labels.

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.

Parameters:
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.


Member Function Documentation

template<class attribute_tmpl, class label_tmpl, class feature_tmpl>
const char* classias::dense_feature_generator_base< attribute_tmpl, label_tmpl, feature_tmpl >::name (  )  const [inline]

Returns the name of the feature generator.

Returns:
const char* The feature name.

template<class attribute_tmpl, class label_tmpl, class feature_tmpl>
size_t classias::dense_feature_generator_base< attribute_tmpl, label_tmpl, feature_tmpl >::num_labels (  )  const [inline]

Returns the total number of labels.

Returns:
size_t The total number of labels.

template<class attribute_tmpl, class label_tmpl, class feature_tmpl>
size_t classias::dense_feature_generator_base< attribute_tmpl, label_tmpl, feature_tmpl >::num_attributes (  )  const [inline]

Returns the total number of attributes.

Returns:
size_t The total number of attributes.

template<class attribute_tmpl, class label_tmpl, class feature_tmpl>
size_t classias::dense_feature_generator_base< attribute_tmpl, label_tmpl, feature_tmpl >::num_features (  )  const [inline]

Returns the total number of features.

Returns:
size_t The total number of features.

template<class attribute_tmpl, class label_tmpl, class feature_tmpl>
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.

Parameters:
num_attributes The total number of attributes.

template<class attribute_tmpl, class label_tmpl, class feature_tmpl>
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.

Parameters:
num_labels The total number of labels.

template<class attribute_tmpl, class label_tmpl, class feature_tmpl>
bool classias::dense_feature_generator_base< attribute_tmpl, label_tmpl, feature_tmpl >::needs_registration (  )  const [inline]

Returns if this class requires registration.

Returns:
bool This class always returns false.

template<class attribute_tmpl, class label_tmpl, class feature_tmpl>
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.

Parameters:
a The attribute.
l The label.
Returns:
feature_type The feature for the attribute and label, which is always identical to the attribute.

template<class attribute_tmpl, class label_tmpl, class feature_tmpl>
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.

Parameters:
a The attribute.
l The label.
f The feature for the attribute and label, which is always identical to the attribute.
Returns:
bool true if the pair of the attribute and label is successfully mapped to a feature, which is always true.

template<class attribute_tmpl, class label_tmpl, class feature_tmpl>
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.

Parameters:
f The feature.
a The attribute associated with the feature.
l The label associated with the feature.
Returns:
bool if the feature is successfully associated with the attribute and label.


Copyright (c) 2002-2009 by Naoaki Okazaki
Mon Dec 28 23:41:05 2009