Metadata about a particular dataset feature (attribute). More...
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 String & | name () const |
| Gets what the feature is named. | |
| const String & | name () 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 String & | value_name (int value) const |
| Returns the name of a particular nominal value, given its index. | |
| const String & | value_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. | |
Metadata about a particular dataset feature (attribute).
Supports nominal, continuous, and integer values.
Definition at line 59 of file dataset.h.
| enum DatasetFeature::Type |
| enum DatasetFeature::Type |
| 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 '?'.
| 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 '?'.
| 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.
| 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.
| 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] |
| void DatasetFeature::InitInteger | ( | const char * | name_in | ) | [inline] |
| void DatasetFeature::InitNominal | ( | const char * | name_in | ) | [inline] |
| 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).
| 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.
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.
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] |
| const String& DatasetFeature::name | ( | ) | const [inline] |
Gets what the feature is named.
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.
| 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.
| 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.
| Type DatasetFeature::type | ( | ) | const [inline] |
Identifies the type of feature.
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] |
| 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.
| value | the number of the value |
Definition at line 187 of file dataset.h.
References NOMINAL.
Referenced by Format(), and DatasetInfo::WriteArffHeader().
Gets the array of value names.
Useful for creating a nominal feature yourself.
Definition at line 211 of file dataset.h.
Referenced by DatasetInfo::InitFromArff().
1.6.3