![]() |
aGrUM
0.20.3
a C++ library for (probabilistic) graphical models
|
The common class for the tabular database tables. More...
#include <agrum/BN/learning/IDatabaseTable.h>
Public Member Functions | |
Constructors / Destructors | |
template<template< typename > class VARALLOC, template< typename > class MISSALLOC> | |
IDatabaseTable (const MissingValType< MISSALLOC > &missing_symbols, const std::vector< std::string, VARALLOC< std::string > > &var_names, const ALLOC< T_DATA > &alloc) | |
default constructor More... | |
IDatabaseTable (const IDatabaseTable< T_DATA, ALLOC > &from) | |
copy constructor More... | |
IDatabaseTable (const IDatabaseTable< T_DATA, ALLOC > &from, const allocator_type &alloc) | |
copy constructor with a given allocator More... | |
IDatabaseTable (IDatabaseTable< T_DATA, ALLOC > &&from) | |
move constructor More... | |
IDatabaseTable (IDatabaseTable< T_DATA, ALLOC > &&from, const allocator_type &alloc) | |
move constructor with a given allocator More... | |
virtual IDatabaseTable< T_DATA, ALLOC > * | clone () const =0 |
virtual copy constructor More... | |
virtual IDatabaseTable< T_DATA, ALLOC > * | clone (const allocator_type &alloc) const =0 |
virtual copy constructor with a given allocator More... | |
virtual | ~IDatabaseTable () |
destructor More... | |
Iterators | |
iterator | begin () const |
returns a new unsafe handler pointing to the beginning of the database More... | |
iterator_safe | beginSafe () const |
returns a new safe handler pointing to the beginning of the database More... | |
const iterator & | end () const noexcept |
returns a new unsafe handler pointing to the end of the database More... | |
const iterator_safe & | endSafe () const noexcept |
returns a new safe handler pointing to the end of the database More... | |
Accessors / Modifiers | |
const Matrix< T_DATA > & | content () const noexcept |
returns the content (the records) of the database More... | |
iterator | handler () const |
returns a new unsafe handler pointing to the 1st record of the database More... | |
iterator_safe | handlerSafe () const |
returns a new safe handler pointing to the 1st record of the database More... | |
const DBVector< std::string > & | variableNames () const noexcept |
returns the variable names for all the columns of the database More... | |
virtual void | setVariableNames (const std::vector< std::string, ALLOC< std::string > > &names, const bool from_external_object=true)=0 |
sets the names of the variables More... | |
template<template< typename > class OTHER_ALLOC> | |
void | setVariableNames (const std::vector< std::string, OTHER_ALLOC< std::string > > &names, const bool from_external_object=true) |
sets the names of the variables More... | |
const std::string & | variableName (const std::size_t k) const |
returns the name of the kth column of the IDatabaseTable More... | |
std::size_t | columnFromVariableName (const std::string &name) const |
returns the index of the column whose name is passed in argument More... | |
DBVector< std::size_t > | columnsFromVariableName (const std::string &name) const |
returns the indices of all the columns whose name is passed in argument More... | |
std::size_t | nbVariables () const noexcept |
returns the number of variables (columns) of the database More... | |
std::size_t | nbRows () const noexcept |
returns the number of records (rows) in the database More... | |
std::size_t | size () const noexcept |
returns the number of records (rows) in the database More... | |
bool | empty () const noexcept |
indicates whether the database contains some records or not More... | |
virtual void | ignoreColumn (const std::size_t k, const bool from_external_object=true)=0 |
makes the database table ignore from now on the kth column More... | |
virtual const DBVector< std::size_t > | ignoredColumns () const =0 |
returns the set of columns of the original dataset that are ignored More... | |
virtual const DBVector< std::size_t > | inputColumns () const =0 |
returns the set of columns of the original dataset that are present in the IDatabaseTable More... | |
template<template< typename > class OTHER_ALLOC> | |
void | insertRow (const std::vector< std::string, OTHER_ALLOC< std::string > > &new_row) |
insert a new row at the end of the database More... | |
virtual void | insertRow (Row< T_DATA > &&new_row, const IsMissing contains_missing_data) |
insert a new DBRow at the end of the database More... | |
virtual void | insertRow (const Row< T_DATA > &new_row, const IsMissing contains_missing_data) |
insert a new row at the end of the database More... | |
virtual void | insertRows (Matrix< T_DATA > &&new_rows, const DBVector< IsMissing > &rows_have_missing_vals) |
insert a set of new DBRows at the end of the database More... | |
virtual void | insertRows (const Matrix< T_DATA > &new_rows, const DBVector< IsMissing > &rows_have_missing_vals) |
insert a set of new DBRows at the end of the database More... | |
void | eraseRow (std::size_t index) |
erase a given row specified by its index in the table More... | |
void | eraseFirstRow () |
erase the first row More... | |
void | eraseLastRow () |
erase the last row More... | |
void | eraseFirstRows (const std::size_t k) |
erase the k first rows More... | |
void | eraseLastRows (const std::size_t k) |
erase the k last rows More... | |
void | eraseRows (std::size_t deb, std::size_t end) |
erase the rows from the debth to the endth (not included) More... | |
void | eraseAllRows () |
erase all the rows More... | |
virtual void | clear () |
erase the content of the database, including the names of the variables More... | |
ALLOC< T_DATA > | getAllocator () const |
returns the allocator of the database More... | |
const DBVector< std::string > & | missingSymbols () const |
returns the set of missing symbols More... | |
bool | hasMissingValues () const |
indicates whether the database contains some missing values More... | |
bool | hasMissingValues (const std::size_t k) const |
indicates whether the kth row contains some missing values More... | |
void | setMaxNbThreads (const std::size_t nb) const |
changes the max number of threads that a database can use More... | |
std::size_t | nbThreads () const |
returns the number of threads used to parse the database More... | |
void | setMinNbRowsPerThread (const std::size_t nb) const |
changes the number min of rows a thread should process in a multithreading context More... | |
std::size_t | minNbRowsPerThread () const |
returns the minimum of rows that each thread should process More... | |
void | setAllRowsWeight (const double new_weight) |
assign a given weight to all the rows of the database More... | |
void | setWeight (const std::size_t i, const double weight) |
assigns a given weight to the ith row of the database More... | |
double | weight (const std::size_t i) const |
returns the weight of the ith record More... | |
double | weight () const |
returns the weight of the whole database More... | |
Public Types | |
enum | IsMissing : char { False, True } |
template<typename TX_DATA > | |
using | DBVector = std::vector< TX_DATA, ALLOC< TX_DATA > > |
the type for the vectors used in the IDatabaseTable More... | |
template<typename TX_DATA > | |
using | Row = DBRow< TX_DATA, ALLOC > |
a row of the database More... | |
template<typename TX_DATA > | |
using | Matrix = std::vector< DBRow< TX_DATA, ALLOC >, ALLOC< DBRow< TX_DATA, ALLOC > > > |
the type for the matrices stored into the database More... | |
template<template< typename > class XALLOC> | |
using | MissingValType = std::vector< std::string, XALLOC< std::string > > |
using | value_type = Row< T_DATA > |
Types for STL compliance. More... | |
using | reference = value_type & |
Types for STL compliance. More... | |
using | const_reference = const value_type & |
Types for STL compliance. More... | |
using | pointer = value_type * |
Types for STL compliance. More... | |
using | const_pointer = const value_type * |
Types for STL compliance. More... | |
using | size_type = std::size_t |
Types for STL compliance. More... | |
using | difference_type = std::ptrdiff_t |
Types for STL compliance. More... | |
using | iterator = Handler |
Types for STL compliance. More... | |
using | iterator_safe = HandlerSafe |
Types for STL compliance. More... | |
using | const_iterator = const Handler |
Types for STL compliance. More... | |
using | const_iterator_safe = const HandlerSafe |
Types for STL compliance. More... | |
using | allocator_type = ALLOC< T_DATA > |
Types for STL compliance. More... | |
Protected Attributes | |
DBVector< std::string > | variable_names_ |
the names of the variables for each column More... | |
Matrix< T_DATA > | rows_ |
DBVector< std::string > | missing_symbols_ |
DBVector< IsMissing > | has_row_missing_val_ |
std::size_t | max_nb_threads_ {std::size_t(gum::getMaxNumberOfThreads())} |
std::size_t | min_nb_rows_per_thread_ {100} |
Protected Member Functions | |
bool | isRowSizeOK_ (const std::size_t size) const |
checks whether a size corresponds to the number of columns of the database More... | |
IDatabaseTable< T_DATA, ALLOC > & | operator= (const IDatabaseTable< T_DATA, ALLOC > &from) |
copy operator More... | |
IDatabaseTable< T_DATA, ALLOC > & | operator= (IDatabaseTable< T_DATA, ALLOC > &&from) |
move operator More... | |
Friends | |
class | Handler |
allow the handlers to access the database directly More... | |
class | HandlerSafe |
Classes | |
class | Handler |
the (unsafe) handler for the tabular databases More... | |
class | HandlerSafe |
the safe handler of the tabular databases More... | |
The common class for the tabular database tables.
IDatabases are not intended to be created as is but should be created through the RawDatabaseTable and DatabaseTable classes. They represent the structures shared by these latter classes.
Here is an example of how to use the class, illustrated with the DatabaseTable class (in this case, the T_DATA type is just equal to DBTranslatedValue):
Definition at line 251 of file IDatabaseTable.h.
using gum::learning::IDatabaseTable< T_DATA, ALLOC >::allocator_type = ALLOC< T_DATA > |
Types for STL compliance.
Definition at line 770 of file IDatabaseTable.h.
using gum::learning::IDatabaseTable< T_DATA, ALLOC >::const_iterator = const Handler |
Types for STL compliance.
Definition at line 768 of file IDatabaseTable.h.
using gum::learning::IDatabaseTable< T_DATA, ALLOC >::const_iterator_safe = const HandlerSafe |
Types for STL compliance.
Definition at line 769 of file IDatabaseTable.h.
using gum::learning::IDatabaseTable< T_DATA, ALLOC >::const_pointer = const value_type* |
Types for STL compliance.
Definition at line 763 of file IDatabaseTable.h.
using gum::learning::IDatabaseTable< T_DATA, ALLOC >::const_reference = const value_type& |
Types for STL compliance.
Definition at line 761 of file IDatabaseTable.h.
using gum::learning::IDatabaseTable< T_DATA, ALLOC >::DBVector = std::vector< TX_DATA, ALLOC< TX_DATA > > |
the type for the vectors used in the IDatabaseTable
Definition at line 257 of file IDatabaseTable.h.
using gum::learning::IDatabaseTable< T_DATA, ALLOC >::difference_type = std::ptrdiff_t |
Types for STL compliance.
Definition at line 765 of file IDatabaseTable.h.
using gum::learning::IDatabaseTable< T_DATA, ALLOC >::iterator = Handler |
Types for STL compliance.
Definition at line 766 of file IDatabaseTable.h.
using gum::learning::IDatabaseTable< T_DATA, ALLOC >::iterator_safe = HandlerSafe |
Types for STL compliance.
Definition at line 767 of file IDatabaseTable.h.
using gum::learning::IDatabaseTable< T_DATA, ALLOC >::Matrix = std::vector< DBRow< TX_DATA, ALLOC >, ALLOC< DBRow< TX_DATA, ALLOC > > > |
the type for the matrices stored into the database
Definition at line 265 of file IDatabaseTable.h.
using gum::learning::IDatabaseTable< T_DATA, ALLOC >::MissingValType = std::vector< std::string, XALLOC< std::string > > |
Definition at line 268 of file IDatabaseTable.h.
using gum::learning::IDatabaseTable< T_DATA, ALLOC >::pointer = value_type* |
Types for STL compliance.
Definition at line 762 of file IDatabaseTable.h.
using gum::learning::IDatabaseTable< T_DATA, ALLOC >::reference = value_type& |
Types for STL compliance.
Definition at line 760 of file IDatabaseTable.h.
using gum::learning::IDatabaseTable< T_DATA, ALLOC >::Row = DBRow< TX_DATA, ALLOC > |
a row of the database
Definition at line 261 of file IDatabaseTable.h.
using gum::learning::IDatabaseTable< T_DATA, ALLOC >::size_type = std::size_t |
Types for STL compliance.
Definition at line 764 of file IDatabaseTable.h.
using gum::learning::IDatabaseTable< T_DATA, ALLOC >::value_type = Row< T_DATA > |
Types for STL compliance.
Definition at line 759 of file IDatabaseTable.h.
enum gum::learning::IDatabaseTable::IsMissing : char |
gum::learning::IDatabaseTable< T_DATA, ALLOC >::IDatabaseTable | ( | const MissingValType< MISSALLOC > & | missing_symbols, |
const std::vector< std::string, VARALLOC< std::string > > & | var_names, | ||
const ALLOC< T_DATA > & | alloc | ||
) |
default constructor
gum::learning::IDatabaseTable< T_DATA, ALLOC >::IDatabaseTable | ( | const IDatabaseTable< T_DATA, ALLOC > & | from | ) |
copy constructor
gum::learning::IDatabaseTable< T_DATA, ALLOC >::IDatabaseTable | ( | const IDatabaseTable< T_DATA, ALLOC > & | from, |
const allocator_type & | alloc | ||
) |
copy constructor with a given allocator
gum::learning::IDatabaseTable< T_DATA, ALLOC >::IDatabaseTable | ( | IDatabaseTable< T_DATA, ALLOC > && | from | ) |
move constructor
gum::learning::IDatabaseTable< T_DATA, ALLOC >::IDatabaseTable | ( | IDatabaseTable< T_DATA, ALLOC > && | from, |
const allocator_type & | alloc | ||
) |
move constructor with a given allocator
|
virtual |
destructor
iterator gum::learning::IDatabaseTable< T_DATA, ALLOC >::begin | ( | ) | const |
returns a new unsafe handler pointing to the beginning of the database
iterator_safe gum::learning::IDatabaseTable< T_DATA, ALLOC >::beginSafe | ( | ) | const |
returns a new safe handler pointing to the beginning of the database
|
virtual |
erase the content of the database, including the names of the variables
Reimplemented in gum::learning::DatabaseTable< ALLOC >, and gum::learning::RawDatabaseTable< ALLOC >.
|
pure virtual |
virtual copy constructor
Implemented in gum::learning::DatabaseTable< ALLOC >, and gum::learning::RawDatabaseTable< ALLOC >.
|
pure virtual |
virtual copy constructor with a given allocator
Implemented in gum::learning::DatabaseTable< ALLOC >, and gum::learning::RawDatabaseTable< ALLOC >.
std::size_t gum::learning::IDatabaseTable< T_DATA, ALLOC >::columnFromVariableName | ( | const std::string & | name | ) | const |
returns the index of the column whose name is passed in argument
UndefinedElement | is raised if there exists no column with the given name |
DBVector< std::size_t > gum::learning::IDatabaseTable< T_DATA, ALLOC >::columnsFromVariableName | ( | const std::string & | name | ) | const |
returns the indices of all the columns whose name is passed in argument
It may happen that several columns correspond to a given variable name. In this case, the function returns the indices of all the columns of the IDatabase that match the name.
|
noexcept |
returns the content (the records) of the database
|
noexcept |
indicates whether the database contains some records or not
|
noexcept |
returns a new unsafe handler pointing to the end of the database
|
noexcept |
returns a new safe handler pointing to the end of the database
void gum::learning::IDatabaseTable< T_DATA, ALLOC >::eraseAllRows | ( | ) |
erase all the rows
void gum::learning::IDatabaseTable< T_DATA, ALLOC >::eraseFirstRow | ( | ) |
erase the first row
void gum::learning::IDatabaseTable< T_DATA, ALLOC >::eraseFirstRows | ( | const std::size_t | k | ) |
erase the k first rows
void gum::learning::IDatabaseTable< T_DATA, ALLOC >::eraseLastRow | ( | ) |
erase the last row
void gum::learning::IDatabaseTable< T_DATA, ALLOC >::eraseLastRows | ( | const std::size_t | k | ) |
erase the k last rows
void gum::learning::IDatabaseTable< T_DATA, ALLOC >::eraseRow | ( | std::size_t | index | ) |
erase a given row specified by its index in the table
In the database, rows are indexed, starting from 0.
void gum::learning::IDatabaseTable< T_DATA, ALLOC >::eraseRows | ( | std::size_t | deb, |
std::size_t | end | ||
) |
erase the rows from the debth to the endth (not included)
In the database, rows are indexed, starting from 0.
ALLOC< T_DATA > gum::learning::IDatabaseTable< T_DATA, ALLOC >::getAllocator | ( | ) | const |
returns the allocator of the database
iterator gum::learning::IDatabaseTable< T_DATA, ALLOC >::handler | ( | ) | const |
returns a new unsafe handler pointing to the 1st record of the database
iterator_safe gum::learning::IDatabaseTable< T_DATA, ALLOC >::handlerSafe | ( | ) | const |
returns a new safe handler pointing to the 1st record of the database
bool gum::learning::IDatabaseTable< T_DATA, ALLOC >::hasMissingValues | ( | ) | const |
indicates whether the database contains some missing values
bool gum::learning::IDatabaseTable< T_DATA, ALLOC >::hasMissingValues | ( | const std::size_t | k | ) | const |
indicates whether the kth row contains some missing values
|
pure virtual |
makes the database table ignore from now on the kth column
This method can be called in two different ways: either k refers to the current kth column of the database table (in this case, parameter from_external_object is set to false), or k corresponds to the kth column of an original dataset used to fill the database table (in this case from_external_object is set to true). Depending on from_external_object's value, the ignored columns may differ. As an example, imagine that the database table is created from a CSV file with 5 columns named X0, X1, X2, X3 and X4 respectivly. Then a call to ignoreColumn ( 1, true ) will exclude column X1 from the database table. As a result, the database table columns are X0, X2, X3 and X4. Therefore, subsequently calling ignoreColumn ( 1, false ) will result in excluding X2 since X2 is the 2nd column (columns are indexed starting from 0). So, now the database table's columns are X0, X3 and X4. If, now, we call ignoreColumn ( 3, true ), this will remove column X3 because, in the original database, X3 was the 4th column.
k | the column to remove. See the above detailed description on how k is computed. |
from_external_object | indicates whether k refers to the kth column of an original external database or to the current kth column of the database table. |
Implemented in gum::learning::DatabaseTable< ALLOC >, and gum::learning::RawDatabaseTable< ALLOC >.
|
pure virtual |
returns the set of columns of the original dataset that are ignored
Implemented in gum::learning::DatabaseTable< ALLOC >, and gum::learning::RawDatabaseTable< ALLOC >.
|
pure virtual |
returns the set of columns of the original dataset that are present in the IDatabaseTable
Implemented in gum::learning::DatabaseTable< ALLOC >, and gum::learning::RawDatabaseTable< ALLOC >.
void gum::learning::IDatabaseTable< T_DATA, ALLOC >::insertRow | ( | const std::vector< std::string, OTHER_ALLOC< std::string > > & | new_row | ) |
insert a new row at the end of the database
The new_row passed in argument is supposed to come from an external database. So it must contain data for the ignored columns.
SizeError | is raised if the vector of string cannot be inserted in the IDatabaseTable because its size does not allow a matching with the columns of the IDatabaseTable (taking into account the ignored columns) |
|
virtual |
insert a new DBRow at the end of the database
Unlike methods insertRow for data whose type is different from T_DATA, this method assumes that the new row passed in argument does not contain any data of the ignored columns. So, basically, it could be copied as is into the database table.
SizeError | is raised if the size of the new_row is not equal to the number of columns retained in the IDatabaseTable |
|
virtual |
insert a new row at the end of the database
Unlike methods insertRow for data whose type is different from T_DATA, this method assumes that the new row passed in argument does not contain any data of the ignored columns. So, basically, it could be copied as is into the database table.
SizeError | is raised if the size of the new_row is not equal to the number of columns retained in the IDatabaseTable |
|
virtual |
insert a set of new DBRows at the end of the database
Unlike methods insertRows for data whose type is different from T_DATA, this method assumes that the new rows passed in argument do not contain any data of the ignored columns. So, basically, these rows could be copied as is into the database table.
new_rows | the new set of rows to be copied as is |
rows_have_missing_vals | a vector of the same size as new_rows that indicates, for each new row, whether it contains some missing value or not |
SizeError | is raised if the size of at least one row in new_rows is not equal to the number of columns retained in the IDatabaseTable. A SizeError exception will also be raised if the number of new rows is not identical to the size of vector rows_have_missing_vals. |
|
virtual |
insert a set of new DBRows at the end of the database
Unlike methods insertRows for data whose type is different from T_DATA, this method assumes that the new rows passed in argument do not contain any data of the ignored columns. So, basically, these rows could be copied as is into the database table.
new_rows | the new set of rows to be copied as is |
rows_have_missing_vals | a vector of the same size as new_rows that indicates, for each new row, whether it contains some missing value or not |
SizeError | is raised if the size of at least one row in new_rows is not equal to the number of columns retained in the IDatabaseTable. A SizeError exception will also be raised if the number of new rows is not identical to the size of vector rows_have_missing_vals. |
|
protected |
checks whether a size corresponds to the number of columns of the database
std::size_t gum::learning::IDatabaseTable< T_DATA, ALLOC >::minNbRowsPerThread | ( | ) | const |
returns the minimum of rows that each thread should process
const DBVector< std::string >& gum::learning::IDatabaseTable< T_DATA, ALLOC >::missingSymbols | ( | ) | const |
returns the set of missing symbols
|
noexcept |
returns the number of records (rows) in the database
std::size_t gum::learning::IDatabaseTable< T_DATA, ALLOC >::nbThreads | ( | ) | const |
returns the number of threads used to parse the database
|
noexcept |
returns the number of variables (columns) of the database
|
protected |
copy operator
|
protected |
move operator
void gum::learning::IDatabaseTable< T_DATA, ALLOC >::setAllRowsWeight | ( | const double | new_weight | ) |
assign a given weight to all the rows of the database
void gum::learning::IDatabaseTable< T_DATA, ALLOC >::setMaxNbThreads | ( | const std::size_t | nb | ) | const |
changes the max number of threads that a database can use
Within databases, some methods can be processed in a parallel fashion. This methods indicates the maximum number of threads that can be run in parallel at the same time.
void gum::learning::IDatabaseTable< T_DATA, ALLOC >::setMinNbRowsPerThread | ( | const std::size_t | nb | ) | const |
changes the number min of rows a thread should process in a multithreading context
When a method executes several threads to perform actions on the rows of the database, the MinNbRowsPerThread indicates how many rows each thread should at least process. This is used to compute the number of threads actually run. This number is equal to the min between the max number of threads allowed and the number of records in the database divided by nb.
|
pure virtual |
sets the names of the variables
This method can be called in two different ways: either the names correspond precisely to the columns stored into the database table (in this case, parameter from_external_object is equal to false), or they corresponds to the columns of an external database (e.g., a CSV file) from which we potentially excluded some columns and, consequently, the latter should not be taken into account (in this case, parameter from_external_object is equal to true). As an example, imagine that the database table is created from a CSV file with 5 columns named X0, X1, X2, X3 and X4 respectively. Suppose that we asked the database table to ignore columns X1 and X3. Then setVariableNames( { "X0", "X1", "X2", "X3", "X4" }, true ) will set the columns of the database table as { "X0", "X2", "X4" }. The same result could be obtained by executing setVariableNames( { "X0", "X2", "X4" }, false ), which specifies directly the set of names to retain in the database table.
names | the names of all the columns, including the ignored columns if from_external_object is set to true, else excluding them (i.e., this should precisely correspond to the columns stored into the database table). |
from_external_object | a Boolean indicating whether parameter names includes the columns ignored by the database table (true) or not (false). |
SizeError | is raised if the names passed in arguments cannot be assigned to the columns of the IDatabaseTable because the size of their vector is inadequate. |
Implemented in gum::learning::DatabaseTable< ALLOC >, and gum::learning::RawDatabaseTable< ALLOC >.
void gum::learning::IDatabaseTable< T_DATA, ALLOC >::setVariableNames | ( | const std::vector< std::string, OTHER_ALLOC< std::string > > & | names, |
const bool | from_external_object = true |
||
) |
sets the names of the variables
This method can be called in two different ways: either the names correspond precisely to the columns stored into the database table (in this case, parameter from_external_object is equal to false), or they corresponds to the columns of an external database (e.g., a CSV file) from which we potentially excluded some columns and, consequently, the latter should not be taken into account (in this case, parameter from_external_object is equal to true). As an example, imagine that the database table is created from a CSV file with 5 columns named X0, X1, X2, X3 and X4 respectively. Suppose that we asked the database table to ignore columns X1 and X3. Then setVariableNames( { "X0", "X1", "X2", "X3", "X4" }, true ) will set the columns of the database table as { "X0", "X2", "X4" }. The same result could be obtained by executing setVariableNames( { "X0", "X2", "X4" }, false ), which specifies directly the set of names to retain in the database table.
names | the names of all the columns, including the ignored columns if from_external_object is set to true, else excluding them (i.e., this should precisely correspond to the columns stored into the database table). |
from_external_object | a Boolean indicating whether parameter names includes the columns ignored by the database table (true) or not (false). |
SizeError | is raised if the names passed in arguments cannot be assigned to the columns of the IDatabaseTable because the size of their vector is inadequate. |
void gum::learning::IDatabaseTable< T_DATA, ALLOC >::setWeight | ( | const std::size_t | i, |
const double | weight | ||
) |
assigns a given weight to the ith row of the database
OutOfBounds | if i is outside the set of indices of the records or if the weight is negative |
|
noexcept |
returns the number of records (rows) in the database
const std::string& gum::learning::IDatabaseTable< T_DATA, ALLOC >::variableName | ( | const std::size_t | k | ) | const |
returns the name of the kth column of the IDatabaseTable
OutOfBounds | is raised if the IDatabaseTable contains fewer than k columns. |
|
noexcept |
returns the variable names for all the columns of the database
The names do not include the ignored columns.
double gum::learning::IDatabaseTable< T_DATA, ALLOC >::weight | ( | const std::size_t | i | ) | const |
returns the weight of the ith record
OutOfBounds | if i is outside the set of indices of the records |
double gum::learning::IDatabaseTable< T_DATA, ALLOC >::weight | ( | ) | const |
returns the weight of the whole database
|
friend |
allow the handlers to access the database directly
Definition at line 1195 of file IDatabaseTable.h.
|
friend |
Definition at line 1196 of file IDatabaseTable.h.
|
protected |
Definition at line 1142 of file IDatabaseTable.h.
|
mutableprotected |
Definition at line 1145 of file IDatabaseTable.h.
|
mutableprotected |
Definition at line 1149 of file IDatabaseTable.h.
|
protected |
Definition at line 1139 of file IDatabaseTable.h.
|
protected |
Definition at line 1136 of file IDatabaseTable.h.
|
protected |
the names of the variables for each column
Definition at line 1133 of file IDatabaseTable.h.