#include <attributes.h>
Attributes::Attributes |
( |
| ) |
|
void Attributes::add |
( |
Attribute * |
attribute | ) |
|
throw | ( | logic_error |
| ) | | |
Adds a new attribute to this set of attributes.
- Parameters
-
attribute | the attribute's name |
- Exceptions
-
logic_error | if the attribute can not be added because of type or memory problems |
Attribute * Attributes::get |
( |
int |
i | ) |
const |
throw | ( | logic_error |
| ) | | |
Returns the ith attribute in this set of attributes.
- Parameters
-
i | the index of the specified attribute |
- Returns
- the ith Attribute
- Exceptions
-
logic_error | if the index is out of range |
Attribute * Attributes::getClassAttribute |
( |
| ) |
const |
throw | ( | logic_error |
| ) | | |
Returns the class attribute.
- Returns
- the class attribute
- Exceptions
-
logic_error | if the class index is out of range |
int Attributes::getClassIndex |
( |
| ) |
const |
throw | ( | logic_error |
| ) | | |
Returns the index of the class label.
- Returns
- the index of the class label
- Exceptions
-
logic_error | if the class index is out of range |
bool Attributes::getHasNominalAttributes |
( |
| ) |
const |
Returns true if this set of attributes has one or more nominal attributes; returns false otherwise.
- Returns
- true if this set of attributes has nominal attributes
bool Attributes::getHasNumericAttributes |
( |
| ) |
const |
Returns true if this set of attributes has one or more numeric attributes; returns false otherwise.
- Returns
- true if this set of attributes has numeric attributes
int Attributes::getIndex |
( |
string |
name | ) |
const |
throw | ( | logic_error |
| ) | | |
Returns the attribute's index.
- Parameters
-
- Returns
- the attribute's position in the names array
- Exceptions
-
logic_error | if the name is invalid |
int Attributes::getSize |
( |
| ) |
const |
Returns the number of attributes.
- Returns
- the number of attributes
void Attributes::parse |
( |
istream & |
in | ) |
|
throw | ( | logic_error |
| ) | | |
Parses the attribute declarations in the specified input stream. By convention, the last attribute is the class label after parsing.
- Parameters
-
in | an input stream containing the data set's tokens |
- Exceptions
-
logic_error | if there is a parse error |
void Attributes::setClassIndex |
( |
int |
classIndex | ) |
|
throw | ( | logic_error |
| ) | | |
Sets the class index for this set of attributes.
- Parameters
-
classIndex | the new class index |
- Exceptions
-
logic_error | if the index is out of range |
ostream& operator<< |
( |
ostream & |
out, |
|
|
const Attributes & |
a |
|
) |
| |
|
friend |
Writes the specified attributes to the output stream and returns it.
- Parameters
-
out | the output stream for writing |
a | the specified attribute for writing |
- Returns
- the modified output stream
int Attributes::classIndex |
|
private |
stores the position of the class label
bool Attributes::hasNominalAttributes |
|
private |
a flag indicating that the data set has one or more nominal attributes
bool Attributes::hasNumericAttributes |
|
private |
a flag indicating that the data set has one or more numeric attributes
The documentation for this class was generated from the following files: