#include <dataset.h>
Public Member Functions | |
DataSet () | |
DataSet (const Attributes &attributes) throw ( logic_error ) | |
void | add (const DataSet &dataset) throw ( logic_error ) |
void | add (const Example &example) throw ( logic_error ) |
Attributes | getAttributes () const |
Examples | getExamples () const |
long | getSeed () const |
bool | getHasNominalAttributes () const |
bool | getHasNumericAttributes () const |
void | load (string filename) throw ( logic_error ) |
void | parse (istream &in) throw ( logic_error ) |
void | setOptions (const vector< string > &options) throw ( logic_error ) |
void | setSeed (long seed) |
Protected Attributes | |
string | name |
Attributes | attributes |
Examples | examples |
long | seed = 2026875034 |
Friends | |
ostream & | operator<< (ostream &out, const DataSet &ds) |
Implements a class for a data set for machine-learning methods.
DataSet::DataSet | ( | ) |
Default constructor.
DataSet::DataSet | ( | const Attributes & | attributes | ) | |
throw | ( | logic_error | |||
) |
Explicit constructor.
attributes | the attributes for this data set |
logic_error | if the examples can not be added because of type or memory problems |
void DataSet::add | ( | const DataSet & | dataset | ) | |
throw | ( | logic_error | |||
) |
Adds the examples of the specified data set to this data set.
dataset | the data set to be added |
logic_error | if the examples can not be added because of type or memory problems |
void DataSet::add | ( | const Example & | example | ) | |
throw | ( | logic_error | |||
) |
Adds the specified example to this data set.
example | the example to be added |
logic_error | if the examples can not be added because of type or memory problems |
Attributes DataSet::getAttributes | ( | ) | const |
Gets the attributes of this DataSet object.
Examples DataSet::getExamples | ( | ) | const |
Gets the examples of this data set.
bool DataSet::getHasNominalAttributes | ( | ) | const |
Returns true if this data set has nominal attributes; returns false otherwise.
bool DataSet::getHasNumericAttributes | ( | ) | const |
Returns true if this data set has numeric attributes; returns false otherwise.
long DataSet::getSeed | ( | ) | const |
Gets the seed for this data set.
void DataSet::load | ( | string | filename | ) | |
throw | ( | logic_error | |||
) |
Loads a data set from the specified file.
filename | the file from which to read |
logic_error | if the file is not found or if a parse error occurs |
void DataSet::parse | ( | istream & | in | ) | |
throw | ( | logic_error | |||
) |
Parses a data set from the specified input stream, which consists of parsing the data set's header, attributes, and examples.
in | an input stream containing the data set's tokens |
logic_error | if a parse error occurs |
void DataSet::setOptions | ( | const vector< string > & | options | ) | |
throw | ( | logic_error | |||
) |
Sets the options for this data set. -s
sets the random seed for this data set.
options | the arguments |
logic_error | if an option is illegal |
void DataSet::setSeed | ( | long | seed | ) |
Sets the random number seed for this data set. This also seeds the random number generator.
seed | the seed |
|
friend |
Writes the specified data set to the output stream and returns it.
out | the output stream for writing |
ds | the data set for writing |
|
protected |
the attributes of this data set
|
protected |
the examples of this data set
|
protected |
the name of this data set
|
protected |
default random seed