Public Member Functions | |
std::vector< double > | computeIEMIntervals (size_t value_column, size_t class_column) const |
Create a discretization of the numeric data in the specified column. | |
DataSet () | |
Construct a new (empty) DataSet object. | |
DataSet (const std::string &csvStringOrFileName, int separator, ParseListener *pl) | |
Construct a DataSet from a CSV specification provided in a file or as a string. | |
void | deleteColumn (size_t column) |
Delete the specified column from this DataSet. | |
void | deleteRow (size_t row) |
Delete the specified row from this DataSet. | |
std::string | getColumnName (size_t column) const |
Return the name of the specified column of this DataSet. | |
const char * | getDataItem (size_t row, size_t column) const |
Return the data item at the specified location of this DataSet. | |
size_t | getNumberOfColumns () const |
Return the number of columns in this DataSet. | |
size_t | getNumberOfRows () const |
Return the number of rows in this DataSet. | |
void | moveColumn (size_t column, size_t new_column) |
Moves the specified column to a new position. | |
void | moveRow (size_t row, size_t new_row) |
Move the specified row to a new position. | |
size_t | newColumn (const char *name) |
Create a new column in this DataSet. | |
size_t | newColumn (const std::string &name) |
Create a new column in this DataSet. | |
size_t | newRow () |
Create a new row in this DataSet. | |
void | saveAsCSV (const std::string &file_name, int delimiter) |
Save this DataSet in the format of a comma-separated-values (CSV) file. | |
void | setColumnName (size_t column, const std::string &name) |
Set the name of the specified column of this DataSet. | |
void | setColumnName (size_t column, const char *name) |
Set the name of the specified column of this DataSet. | |
void | setDataItem (size_t row, size_t column, const std::string &data) |
Set the data item at the specified location of this DataSet. | |
void | setDataItem (size_t row, size_t column, const char *data) |
Set (or delete) the data item at the specified location of this DataSet. | |
std::string | toCSVString (int delimiter) const |
Create a CSV representation (as a string) of this DataSet. | |
~DataSet () throw () | |
Destruct a DataSet object. |
HAPI::DataSet::DataSet | ( | const std::string & | csvStringOrFileName, |
int | separator, | ||
ParseListener * | pl | ||
) |
Construct a DataSet from a CSV specification provided in a file or as a string.
Instead of a comma, a different separator character may be used.
csvStringOrFileName | a string containing a CSV specification or the name of a CSV file |
separator | the separator character (must not be a double-quote character) |
pl | the ParseListener used for handling parse errors. |
std::vector<double> HAPI::DataSet::computeIEMIntervals | ( | size_t | value_column, |
size_t | class_column | ||
) | const |
Create a discretization of the numeric data in the specified column.
The supervised discretization algorithm by Fayyad and Irani is used to create intervals for the numeric data in the column with index value_column
. The class data used to guide the discretization is contained in the column with index class_column
.
value_column | the index of the column to discretize |
class_column | the index of the column containing the class (or target) data. |
void HAPI::DataSet::deleteColumn | ( | size_t | column ) |
Delete the specified column from this DataSet.
Columns to the right of the deleted column will be shifted one position to the left.
column | the index of the column to be deleted |
void HAPI::DataSet::deleteRow | ( | size_t | row ) |
Delete the specified row from this DataSet.
Rows below the deleted row will be shifted one position up.
row | the index of the row to be deleted |
std::string HAPI::DataSet::getColumnName | ( | size_t | column ) | const |
Return the name of the specified column of this DataSet.
column | the index of the column |
const char* HAPI::DataSet::getDataItem | ( | size_t | row, |
size_t | column | ||
) | const |
Return the data item at the specified location of this DataSet.
row | the index of the row |
column | the index of the column |
void HAPI::DataSet::moveColumn | ( | size_t | column, |
size_t | new_column | ||
) |
Moves the specified column to a new position.
The columns between the old and the new column positions will be shifted one position to the left or to the right depending on the direction of the move.
column | the index of the column to be moved |
newColumn | the index of the destination column |
void HAPI::DataSet::moveRow | ( | size_t | row, |
size_t | new_row | ||
) |
Move the specified row to a new position.
The rows between the old and the new row positions will be shifted one position up or down depending on the direction of the move.
row | the index of the row to be moved |
newRow | the index of the destination row |
size_t HAPI::DataSet::newColumn | ( | const std::string & | name ) |
Create a new column in this DataSet.
name | the name of the new column |
size_t HAPI::DataSet::newColumn | ( | const char * | name ) |
Create a new column in this DataSet.
name | the name of the new column |
size_t HAPI::DataSet::newRow | ( | ) |
Create a new row in this DataSet.
void HAPI::DataSet::saveAsCSV | ( | const std::string & | file_name, |
int | delimiter | ||
) |
Save this DataSet in the format of a comma-separated-values (CSV) file.
However, another delimiter than a comma may be used.
file_name | the name of the file in which to store the data |
delimiter | the delimiter character (must not be a double-quote character). |
void HAPI::DataSet::setColumnName | ( | size_t | column, |
const char * | name | ||
) |
Set the name of the specified column of this DataSet.
column | the index of the column |
name | the new name of the column |
void HAPI::DataSet::setColumnName | ( | size_t | column, |
const std::string & | name | ||
) |
Set the name of the specified column of this DataSet.
column | the index of the column |
name | the new name of the column |
void HAPI::DataSet::setDataItem | ( | size_t | row, |
size_t | column, | ||
const char * | data | ||
) |
Set (or delete) the data item at the specified location of this DataSet.
row | the index of the row |
column | the index of the column |
data | the new data item (a NULL value causes the item to be deleted). |
void HAPI::DataSet::setDataItem | ( | size_t | row, |
size_t | column, | ||
const std::string & | data | ||
) |
Set the data item at the specified location of this DataSet.
row | the index of the row |
column | the index of the column |
data | the new data item. |
std::string HAPI::DataSet::toCSVString | ( | int | delimiter ) | const |
Create a CSV representation (as a string) of this DataSet.
delimiter | the delimiter character (must not be a double-quote character). |