classias::multi_instance_base< attributes_tmpl, weight_tmpl, group_tmpl > Class Template Reference


Detailed Description

template<class attributes_tmpl, class weight_tmpl = weight_base, class group_tmpl = group_base>
class classias::multi_instance_base< attributes_tmpl, weight_tmpl, group_tmpl >

A template class for multi-class instances.

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).

Parameters:
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.
See also:
sparse_vector_base, weight_base, 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_typeattributes (int i) const
 Returns a read-only access to the attribute vector.
attributes_typeattributes (int i)
 Returns an access to the attribute vector.

Protected Attributes

int m_index
 The candidate index of this instance.


Member Function Documentation

template<class attributes_tmpl, class weight_tmpl = weight_base, class group_tmpl = group_base>
void classias::multi_instance_base< attributes_tmpl, weight_tmpl, group_tmpl >::set_label ( int  i  )  [inline]

Sets the label.

Parameters:
i The label index.

template<class attributes_tmpl, class weight_tmpl = weight_base, class group_tmpl = group_base>
int classias::multi_instance_base< attributes_tmpl, weight_tmpl, group_tmpl >::get_label (  )  const [inline]

Gets the label.

Returns:
bool The label index of this instance.

template<class attributes_tmpl, class weight_tmpl = weight_base, class group_tmpl = group_base>
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.

Parameters:
L The total number of labels in the dataset.
Returns:
int The number of possible candidate labels for this instance. The return value is always identical to L for multi-class instances.
See also:
candidate_instance_base

template<class attributes_tmpl, class weight_tmpl = weight_base, class group_tmpl = group_base>
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.

Parameters:
i Reserved only for the compatibility with candidate_instance_base class.
Returns:
const attributes_type& The reference to the attribute vector associated with this instance.

template<class attributes_tmpl, class weight_tmpl = weight_base, class group_tmpl = group_base>
attributes_type& classias::multi_instance_base< attributes_tmpl, weight_tmpl, group_tmpl >::attributes ( int  i  )  [inline]

Returns an access to the attribute vector.

Parameters:
i Reserved only for the compatibility with candidate_instance_base class.
Returns:
attributes_type& The reference to the attribute vector associated with this instance.


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