29 #ifndef GUM_DATABASE_TABLE_H 30 #define GUM_DATABASE_TABLE_H 183 template <
template <
typename >
class ALLOC = std::allocator >
187 template <
typename TX_DATA >
188 using DBVector = std::vector< TX_DATA, ALLOC< TX_DATA > >;
191 template <
typename TX_DATA >
195 template <
typename TX_DATA >
197 std::vector< DBRow< TX_DATA, ALLOC >, ALLOC< DBRow< TX_DATA, ALLOC > > >;
199 template <
template <
typename >
class XALLOC >
233 template <
template <
typename >
class XALLOC >
275 DatabaseTable< ALLOC >& operator=(const DatabaseTable< ALLOC >& from);
278 DatabaseTable< ALLOC >& operator=(DatabaseTable< ALLOC >&& from);
304 const
std::
size_t input_column,
305 const
bool unique_column = true);
329 const
std::
size_t input_column,
330 const
bool unique_column = true);
349 template < template < typename > class XALLOC >
352 const
std::
size_t input_column,
353 std::vector<
std::
string, XALLOC<
std::
string > > missing_symbols,
354 const
bool unique_column = true);
371 const
bool k_is_input_col = false);
390 translator(const
std::
size_t k, const
bool k_is_input_col = false) const;
406 const
bool k_is_input_col = false) const;
437 virtual
void setVariableNames(
438 const
std::vector<
std::
string, ALLOC<
std::
string > >& names,
439 const
bool from_external_object = true) final;
474 const
bool from_external_object = true) final;
500 const
bool k_is_input_col = false) const;
538 const
bool k_is_input_col = false) const;
559 void reorder(const
std::
size_t k, const
bool k_is_input_col = false);
595 virtual
void insertRow(
596 const
std::vector<
std::
string, ALLOC<
std::
string > >& new_row) final;
608 virtual
void insertRow(
Row< DBTranslatedValue >&& new_row,
609 const
IsMissing contains_missing_data) final;
621 virtual
void insertRow(const
Row< DBTranslatedValue >& new_row,
622 const
IsMissing contains_missing_data) final;
631 virtual
void insertRow(const
Row<
DBCell >& new_row) final;
640 virtual
void insertRow(
Row<
DBCell >&& new_row) final;
688 virtual
void clear() final;
703 #ifndef DOXYGEN_SHOULD_SKIP_THIS 721 std::size_t __getKthIndex(
const std::size_t k,
722 const bool k_is_input_col)
const;
729 const bool k_is_input_col)
const;
750 template <
typename Functor1,
typename Functor2 >
751 void __threadProcessDatabase(Functor1& exec_func, Functor2& undo_func);
The union class for storing the translated values in learning databases.
The implementation of tabular databases stored in memory (RAM)
The common class for the tabular database tables.
Base class for every random variable.
std::size_t size_type
Types for STL compliance.
std::vector< TX_DATA, ALLOC< TX_DATA > > DBVector
the type for the vectors used in the DatabaseTable
virtual void ignoreColumn(const std::size_t k, const bool from_external_object=true) final
makes the database table ignore from now on the kth column of the input dataset or the column parsed ...
DBVector< std::size_t > domainSizes() const
returns the domain sizes of all the variables in the database table
typename IDatabaseTable< DBTranslatedValue, ALLOC >::HandlerSafe HandlerSafe
the safe handler type
const DBTranslatorSet< ALLOC > & translatorSet() const
returns the set of translators
The class representing the original values of the cells of databases.
virtual void insertRow(const std::vector< std::string, ALLOC< std::string > > &new_row) final
insert a new row at the end of the database
HandlerSafe iterator_safe
Types for STL compliance.
The databases' cell translators for continuous variables.
std::vector< std::string, XALLOC< std::string > > MissingValType
std::vector< DBRow< TX_DATA, ALLOC >, ALLOC< DBRow< TX_DATA, ALLOC > > > Matrix
the type for the matrices stored into the database
gum is the global namespace for all aGrUM entities
The union class for storing the translated values in learning databases.
ALLOC< DBTranslatedValue > allocator_type
Types for STL compliance.
C++11 threads convenience utilities for agrum.
The class representing a record stored in a tabular database.
Representation of a setA Set is a structure that contains arbitrary elements.
bool needsReordering(const std::size_t k, const bool k_is_input_col=false) const
indicates whether a reordering is needed to sort the translations of the kth translator or those of t...
virtual DatabaseTable< ALLOC > * clone() const final
virtual copy constructor
Handler iterator
Types for STL compliance.
The class representing the original values of the cells of databases.
typename IDatabaseTable< DBTranslatedValue, ALLOC >::Handler Handler
the unsafe handler type
virtual const DBVector< std::size_t > inputColumns() const final
returns the set of columns of the original dataset that are present in the DatabaseTable ...
The base class for all the tabular database cell translators.
const DBTranslator< ALLOC > & translator(const std::size_t k, const bool k_is_input_col=false) const
returns either the kth translator of the database table or the first one reading the kth column of th...
std::size_t domainSize(const std::size_t k, const bool k_is_input_col=false) const
returns the domain size of the kth variable of the database table or of that of the first one corresp...
virtual const DBVector< std::size_t > ignoredColumns() const final
returns the set of columns of the original dataset that are ignored
A class for storing several translators.
The class for storing a record in a database.
const Variable & variable(const std::size_t k, const bool k_is_input_col=false) const
returns either the kth variable of the database table or the first one corresponding to the kth colum...
virtual void insertRows(Matrix< DBTranslatedValue > &&new_rows, const DBVector< IsMissing > &rows_have_missing_vals) final
insert a set of new DBRows at the end of the database
The class representing a tabular database as used by learning tasks.
virtual void clear() final
erase the content of the database, including the names of the variables
std::size_t insertTranslator(const DBTranslator< ALLOC > &translator, const std::size_t input_column, const bool unique_column=true)
insert a new translator into the database table
std::ptrdiff_t difference_type
Types for STL compliance.
virtual void setVariableNames(const std::vector< std::string, ALLOC< std::string > > &names, const bool from_external_object=true) final
sets the names of the variables
typename IDatabaseTable< DBTranslatedValue, ALLOC >::IsMissing IsMissing
the class for packing together the translators used to preprocess the datasets
DatabaseTable(const MissingValType< XALLOC > &missing_symbols, const DBTranslatorSet< ALLOC > &translators=DBTranslatorSet< ALLOC >(), const allocator_type &alloc=allocator_type())
default constructor
void eraseTranslators(const std::size_t k, const bool k_is_input_col=false)
erases either the kth translator or all those parsing the kth column of the input dataset ...
The common class for the tabular database tables.
void reorder()
performs a reordering of all the columns