A relational table. More...
#include <YaDT.h>
Classes | |
class | subset |
A subset of a table. More... | |
Public Member Functions | |
std::string | get_class (size_t pos) const |
Return the class of a given row in the table. | |
double | get_elapsed () const |
Return elapsed time for lastloading of table. | |
std::string | get_name () const |
Return table name. | |
size_t | get_no_columns () const |
Return number of columns in the table. | |
size_t | get_no_rows () const |
Return number of rows in the table. | |
float | get_weight (size_t pos) const |
Return the weight of a given row in the table. | |
subset * | get_wsubset_all () const |
Return new weighted subset for all table rows. | |
subset * | get_wsubset_difference (subset *subtable) const |
Return new weighted subset as difference from a given one. | |
subset * | get_wsubset_first_n (size_t n) const |
Return new weighted subset for first n table rows. | |
subset * | get_wsubset_random (size_t n) const |
Return new weighted subset for n randomly selected (no repetition) table rows. | |
void | load_data (const datasource &ds, const std::string &unknown="?") throw (std::runtime_error) |
Load a table from a datasource. | |
void | load_meta_data (const datasource &ds) throw (std::runtime_error) |
Load metadata from a datasource. | |
const table & | operator= (const table &) |
Assignment constructor not defined. | |
std::ostream * | set_log (std::ostream *new_log) |
Set output log. | |
size_t | set_verbosity (size_t newverbosity) |
Set output log verbosity of operations. | |
table (const std::string &name) | |
Constructor. | |
table (const table &) | |
Copy constructor not defined. | |
void | toBinary (const std::string &filename) const |
Binary output. | |
void | toXML_data_dictionary (std::ostream &os=std::cout) const |
XML output of data dictionary. | |
void | toXML_mining_schema (std::ostream &os=std::cout) const |
XML output of mining schema. | |
~table () | |
Destructor. | |
Static Public Member Functions | |
static table * | fromBinary (const std::string &filename) |
Binary input. |
A relational table.
A relational table is a collection of attributes (discrete, continuous), of a class and, possibly, of a weights column.
yadt::table::table | ( | const std::string & | name | ) |
Constructor.
name | table name. |
yadt::table::~table | ( | ) |
Destructor.
yadt::table::table | ( | const table & | ) |
Copy constructor not defined.
static table* yadt::table::fromBinary | ( | const std::string & | filename | ) | [static] |
Binary input.
Attention: binary input/output is not guarranteed to be consistent among different releases of this library!!
filename | the output filename. |
std::string yadt::table::get_class | ( | size_t | pos | ) | const |
Return the class of a given row in the table.
double yadt::table::get_elapsed | ( | ) | const |
Return elapsed time for lastloading of table.
In other words, this method returns the elapsed time of the last call to the load_data() method.
std::string yadt::table::get_name | ( | ) | const |
Return table name.
size_t yadt::table::get_no_columns | ( | ) | const |
Return number of columns in the table.
size_t yadt::table::get_no_rows | ( | ) | const |
Return number of rows in the table.
float yadt::table::get_weight | ( | size_t | pos | ) | const |
Return the weight of a given row in the table.
Returns default weight (1) if no weight column is in the table.
subset* yadt::table::get_wsubset_all | ( | ) | const |
Return new weighted subset for all table rows.
Weights of cases (i.e., rows) in the returned subset are assigned accordingly to the weights column, if present or to the default value (1.0) otherwise.
Return new weighted subset as difference from a given one.
The returned subset consists of all tables rows not present in the passed subset. Weights of cases (i.e., rows) in the returned w_sequence are assigned accordingly to the weights column, if present or to the default value (1.0) otherwise.
subset* yadt::table::get_wsubset_first_n | ( | size_t | n | ) | const |
Return new weighted subset for first n table rows.
Weights of cases (i.e., rows) in the returned subset are assigned accordingly to the weights column, if present or to the default value (1.0) otherwise.
subset* yadt::table::get_wsubset_random | ( | size_t | n | ) | const |
Return new weighted subset for n randomly selected (no repetition) table rows.
Weights of cases (i.e., rows) in the returned w_sequence are assigned accordingly to the weights column, if present or to the default value (1.0) otherwise.
void yadt::table::load_data | ( | const datasource & | ds, | |
const std::string & | unknown = "?" | |||
) | throw (std::runtime_error) |
Load a table from a datasource.
ds | data source | |
unknown | the unknown token |
void yadt::table::load_meta_data | ( | const datasource & | ds | ) | throw (std::runtime_error) |
Load metadata from a datasource.
std::ostream* yadt::table::set_log | ( | std::ostream * | new_log | ) |
Set output log.
Default value is NULL, i.e. no output.
new_log | output log. |
size_t yadt::table::set_verbosity | ( | size_t | newverbosity | ) |
Set output log verbosity of operations.
Verbosity values are: 0 = none, 1 low, 2 normal, 3 high.
newverbosity | new verbosity of output. |
void yadt::table::toBinary | ( | const std::string & | filename | ) | const |
Binary output.
Attention: binary input/output is not guarranteed to be consistent among different releases of this library!!
filename | the input filename. |
void yadt::table::toXML_data_dictionary | ( | std::ostream & | os = std::cout |
) | const |
XML output of data dictionary.
PMML 2.0 complaint.
void yadt::table::toXML_mining_schema | ( | std::ostream & | os = std::cout |
) | const |
XML output of mining schema.
PMML 2.0 complaint.