DatasetFeature Class Reference

Metadata about a particular dataset feature (attribute). More...

Collaboration diagram for DatasetFeature:
[legend]

List of all members.

Public Types

enum  Type {
  CONTINUOUS, INTEGER, NOMINAL, CONTINUOUS,
  INTEGER, NOMINAL
}
 

Feature types supported.

More...
enum  Type {
  CONTINUOUS, INTEGER, NOMINAL, CONTINUOUS,
  INTEGER, NOMINAL
}
 

Feature types supported.

More...

Public Member Functions

void Format (double value, String *result) const
 Creates a text version of the value based on the type.
void Format (double value, String *result) const
 Creates a text version of the value based on the type.
void InitContinuous (const char *name_in)
 Initialize to be a continuous feature.
void InitContinuous (const char *name_in)
 Initialize to be a continuous feature.
void InitInteger (const char *name_in)
 Initializes to an integer type.
void InitInteger (const char *name_in)
 Initializes to an integer type.
void InitNominal (const char *name_in)
 Initializes to a nominal type.
void InitNominal (const char *name_in)
 Initializes to a nominal type.
index_t n_values () const
 The number of nominal values.
index_t n_values () const
 The number of nominal values.
const Stringname () const
 Gets what the feature is named.
const Stringname () const
 Gets what the feature is named.
success_t Parse (const char *str, double *d) const
 Parses a string into the particular value.
success_t Parse (const char *str, double *d) const
 Parses a string into the particular value.
Type type () const
 Identifies the type of feature.
Type type () const
 Identifies the type of feature.
const Stringvalue_name (int value) const
 Returns the name of a particular nominal value, given its index.
const Stringvalue_name (int value) const
 Returns the name of a particular nominal value, given its index.
ArrayList< String > & value_names ()
 Gets the array of value names.
ArrayList< String > & value_names ()
 Gets the array of value names.

Detailed Description

Metadata about a particular dataset feature (attribute).

Supports nominal, continuous, and integer values.

Definition at line 59 of file dataset.h.


Member Enumeration Documentation

Feature types supported.

Enumerator:
CONTINUOUS 

Real-valued data.

INTEGER 

Integer valued data.

NOMINAL 

Discrete data, each of which has a "name".

CONTINUOUS 

Real-valued data.

INTEGER 

Integer valued data.

NOMINAL 

Discrete data, each of which has a "name".

Definition at line 64 of file dataset.h.

Feature types supported.

Enumerator:
CONTINUOUS 

Real-valued data.

INTEGER 

Integer valued data.

NOMINAL 

Discrete data, each of which has a "name".

CONTINUOUS 

Real-valued data.

INTEGER 

Integer valued data.

NOMINAL 

Discrete data, each of which has a "name".

Definition at line 64 of file dataset.h.


Member Function Documentation

void DatasetFeature::Format ( double  value,
String result 
) const

Creates a text version of the value based on the type.

Continuous parameters are printed in floating point, and integers are shown as integers. For nominal, the value_name(int(value)) is shown. NaN (missing data) is always shown as '?'.

Parameters:
value the value to format
result this will be initialized to the formatted text
void DatasetFeature::Format ( double  value,
String result 
) const

Creates a text version of the value based on the type.

Continuous parameters are printed in floating point, and integers are shown as integers. For nominal, the value_name(int(value)) is shown. NaN (missing data) is always shown as '?'.

Parameters:
value the value to format
result this will be initialized to the formatted text

Definition at line 49 of file dataset.cc.

References CONTINUOUS, String::Copy(), String::InitSprintf(), INTEGER, NOMINAL, and value_name().

Referenced by Dataset::Format().

void DatasetFeature::InitContinuous ( const char *  name_in  )  [inline]

Initialize to be a continuous feature.

Parameters:
name_in the name of the feature

Definition at line 107 of file dataset.h.

References CONTINUOUS.

void DatasetFeature::InitContinuous ( const char *  name_in  )  [inline]

Initialize to be a continuous feature.

Parameters:
name_in the name of the feature

Definition at line 107 of file dataset.h.

References CONTINUOUS.

void DatasetFeature::InitInteger ( const char *  name_in  )  [inline]

Initializes to an integer type.

Parameters:
name_in the name of the feature

Definition at line 117 of file dataset.h.

References INTEGER.

void DatasetFeature::InitInteger ( const char *  name_in  )  [inline]

Initializes to an integer type.

Parameters:
name_in the name of the feature

Definition at line 117 of file dataset.h.

References INTEGER.

void DatasetFeature::InitNominal ( const char *  name_in  )  [inline]

Initializes to a nominal type.

The value_names list starts empty, so you need to add the name of each feature to this. (The dataset reading functions will do this for you).

Parameters:
name_in the name of the feature

Definition at line 131 of file dataset.h.

References NOMINAL.

void DatasetFeature::InitNominal ( const char *  name_in  )  [inline]

Initializes to a nominal type.

The value_names list starts empty, so you need to add the name of each feature to this. (The dataset reading functions will do this for you).

Parameters:
name_in the name of the feature

Definition at line 131 of file dataset.h.

References NOMINAL.

Referenced by DatasetInfo::InitFromArff().

index_t DatasetFeature::n_values (  )  const [inline]

The number of nominal values.

The values 0 to n_values() - 1 are valid. This will return zero for CONTINUOUS and INTEGER types.

Returns:
the number of nominal values

Definition at line 200 of file dataset.h.

References ArrayList< TElem >::size().

index_t DatasetFeature::n_values (  )  const [inline]

The number of nominal values.

The values 0 to n_values() - 1 are valid. This will return zero for CONTINUOUS and INTEGER types.

Returns:
the number of nominal values

Definition at line 200 of file dataset.h.

References ArrayList< TElem >::size().

Referenced by SimpleCrossValidator< TClassifier >::Init(), and DatasetInfo::WriteArffHeader().

const String& DatasetFeature::name (  )  const [inline]

Gets what the feature is named.

Returns:
the name of the feature; for point, "Age" or "X Position"

Definition at line 167 of file dataset.h.

const String& DatasetFeature::name (  )  const [inline]

Gets what the feature is named.

Returns:
the name of the feature; for point, "Age" or "X Position"

Definition at line 167 of file dataset.h.

Referenced by DatasetInfo::WriteArffHeader().

success_t DatasetFeature::Parse ( const char *  str,
double *  d 
) const

Parses a string into the particular value.

Integers and continuous are parsed using the normal functions. For nominal, the entry

If an invalid parse occurs, such as a mal-formatted number or a nominal value not in the list, SUCCESS_FAIL will be returned.

Parameters:
str the string to parse
d where to store the result
success_t DatasetFeature::Parse ( const char *  str,
double *  d 
) const

Parses a string into the particular value.

Integers and continuous are parsed using the normal functions. For nominal, the entry

If an invalid parse occurs, such as a mal-formatted number or a nominal value not in the list, SUCCESS_FAIL will be returned.

Parameters:
str the string to parse
d where to store the result

Definition at line 72 of file dataset.cc.

References CONTINUOUS, DBL_NAN, INTEGER, NOMINAL, and ArrayList< TElem >::size().

Type DatasetFeature::type (  )  const [inline]

Identifies the type of feature.

Returns:
whether this is DatasetFeature::CONTINUOUS, INTEGER, or NOMINAL

Definition at line 176 of file dataset.h.

Type DatasetFeature::type (  )  const [inline]

Identifies the type of feature.

Returns:
whether this is DatasetFeature::CONTINUOUS, INTEGER, or NOMINAL

Definition at line 176 of file dataset.h.

Referenced by SimpleCrossValidator< TClassifier >::Init(), and DatasetInfo::WriteArffHeader().

const String& DatasetFeature::value_name ( int  value  )  const [inline]

Returns the name of a particular nominal value, given its index.

The first nominal value is 0, the second is 1, etc.

Parameters:
value the number of the value

Definition at line 187 of file dataset.h.

References NOMINAL.

const String& DatasetFeature::value_name ( int  value  )  const [inline]

Returns the name of a particular nominal value, given its index.

The first nominal value is 0, the second is 1, etc.

Parameters:
value the number of the value

Definition at line 187 of file dataset.h.

References NOMINAL.

Referenced by Format(), and DatasetInfo::WriteArffHeader().

ArrayList<String>& DatasetFeature::value_names (  )  [inline]

Gets the array of value names.

Useful for creating a nominal feature yourself.

Returns:
a mutable array of value names

Definition at line 211 of file dataset.h.

ArrayList<String>& DatasetFeature::value_names (  )  [inline]

Gets the array of value names.

Useful for creating a nominal feature yourself.

Returns:
a mutable array of value names

Definition at line 211 of file dataset.h.

Referenced by DatasetInfo::InitFromArff().


The documentation for this class was generated from the following files:
Generated on Mon Jan 24 12:04:40 2011 for FASTlib by  doxygen 1.6.3