Public Member Functions | Protected Attributes | Friends | List of all members
DataSet Class Reference

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

Detailed Description

Implements a class for a data set for machine-learning methods.

Author
Mark Maloof
Version
1.1, 2/7/15

Constructor & Destructor Documentation

DataSet::DataSet ( )

Default constructor.

DataSet::DataSet ( const Attributes attributes)
throw (logic_error
)

Explicit constructor.

Parameters
attributesthe attributes for this data set
Exceptions
logic_errorif the examples can not be added because of type or memory problems

Member Function Documentation

void DataSet::add ( const DataSet dataset)
throw (logic_error
)

Adds the examples of the specified data set to this data set.

Parameters
datasetthe data set to be added
Exceptions
logic_errorif 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.

Parameters
examplethe example to be added
Exceptions
logic_errorif the examples can not be added because of type or memory problems
Attributes DataSet::getAttributes ( ) const

Gets the attributes of this DataSet object.

Returns
the attributes of this data set
Examples DataSet::getExamples ( ) const

Gets the examples of this data set.

Returns
the examples of this data set
bool DataSet::getHasNominalAttributes ( ) const

Returns true if this data set has nominal attributes; returns false otherwise.

Returns
true if this data set has nominal attributes
bool DataSet::getHasNumericAttributes ( ) const

Returns true if this data set has numeric attributes; returns false otherwise.

Returns
true if this data set has numeric attributes
long DataSet::getSeed ( ) const

Gets the seed for this data set.

Returns
the seed for this data set
void DataSet::load ( string  filename)
throw (logic_error
)

Loads a data set from the specified file.

Parameters
filenamethe file from which to read
Exceptions
logic_errorif 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.

Parameters
inan input stream containing the data set's tokens
Exceptions
logic_errorif 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.

Parameters
optionsthe arguments
Exceptions
logic_errorif 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.

Parameters
seedthe seed

Friends And Related Function Documentation

ostream& operator<< ( ostream &  out,
const DataSet ds 
)
friend

Writes the specified data set to the output stream and returns it.

Parameters
outthe output stream for writing
dsthe data set for writing
Returns
the modified output stream

Member Data Documentation

Attributes DataSet::attributes
protected

the attributes of this data set

Examples DataSet::examples
protected

the examples of this data set

string DataSet::name
protected

the name of this data set

long DataSet::seed = 2026875034
protected

default random seed


The documentation for this class was generated from the following files: