![]() |
aGrUM
0.20.3
a C++ library for (probabilistic) graphical models
|
The class for initializing DatabaseTable and RawDatabaseTable instances from CSV files. More...
#include <agrum/tools/database/DBInitializerFromCSV.h>
Public Member Functions | |
Constructors / Destructors | |
DBInitializerFromCSV (const std::string filename, bool fileContainsNames=true, const std::string delimiter=",", const char commentmarker='#', const char quoteMarker='"', const allocator_type& alloc = allocator_type()) | |
default constructor More... | |
DBInitializerFromCSV (const DBInitializerFromCSV< ALLOC > &from) | |
copy constructor More... | |
DBInitializerFromCSV (const DBInitializerFromCSV< ALLOC > &from, const allocator_type &alloc) | |
copy constructor with a given allocator More... | |
DBInitializerFromCSV (DBInitializerFromCSV< ALLOC > &&from) | |
move constructor More... | |
DBInitializerFromCSV (DBInitializerFromCSV< ALLOC > &&from, const allocator_type &alloc) | |
move constructor with a given allocator More... | |
virtual DBInitializerFromCSV< ALLOC > * | clone () const |
virtual copy constructor More... | |
virtual DBInitializerFromCSV< ALLOC > * | clone (const allocator_type &alloc) const |
virtual copy constructor with a given allocator More... | |
virtual | ~DBInitializerFromCSV () |
destructor More... | |
Operators | |
DBInitializerFromCSV< ALLOC > & | operator= (const DBInitializerFromCSV< ALLOC > &from) |
copy operator More... | |
DBInitializerFromCSV< ALLOC > & | operator= (DBInitializerFromCSV< ALLOC > &&from) |
move operator More... | |
Accessors / Modifiers | |
const std::vector< std::string, ALLOC< std::string > > & | variableNames () |
returns the names of the variables in the input dataset More... | |
template<template< template< typename > class > class DATABASE> | |
void | fillDatabase (DATABASE< ALLOC > &database, const bool retry_insertion=false) |
fills the rows of the database table More... | |
std::size_t | throwingColumn () const |
This method indicates which column filling raised an exception, if any, during the execution of fillDatabase. More... | |
allocator_type | getAllocator () const |
returns the allocator used More... | |
Public Types | |
using | allocator_type = ALLOC< std::string > |
type for the allocators passed in arguments of methods More... | |
enum | InputType : char { InputType::STRING, InputType::DBCELL } |
the enumeration indicating the type of the data the IDBInitializer expects as input data More... | |
Protected Member Functions | |
virtual std::vector< std::string, ALLOC< std::string > > | variableNames_ () final |
returns the names of the variables More... | |
virtual const std::vector< std::string, ALLOC< std::string > > & | currentStringRow_ () final |
returns the content of the current row using strings More... | |
virtual bool | nextRow_ () final |
indicates whether there is a next row to read (and point on it) More... | |
virtual const DBRow< DBCell, ALLOC > & | currentDBCellRow_ () |
asks the child class for the content of the current row using dbcells More... | |
The class for initializing DatabaseTable and RawDatabaseTable instances from CSV files.
In aGrUM, the usual way to create DatabaseTable instances used by learning algorithms is to use the 4-step process below:
Definition at line 131 of file DBInitializerFromCSV.h.
using gum::learning::DBInitializerFromCSV< ALLOC >::allocator_type = ALLOC< std::string > |
type for the allocators passed in arguments of methods
Definition at line 134 of file DBInitializerFromCSV.h.
|
stronginherited |
the enumeration indicating the type of the data the IDBInitializer expects as input data
Enumerator | |
---|---|
STRING | |
DBCELL |
Definition at line 120 of file IDBInitializer.h.
gum::learning::DBInitializerFromCSV< ALLOC >::DBInitializerFromCSV | ( | const std::string | filename, |
bool | fileContainsNames = true , |
||
const std::string | delimiter = "," , |
||
const char | commentmarker = '#' , |
||
const char | quoteMarker = '"' , |
||
const allocator_type & | alloc = allocator_type() |
||
) |
default constructor
filename | the name of the CSV file |
fileContainsNames | a Boolean indicating whether the first line of the CSV file contains the names of the columns |
delimiter | the character that acts as the column separator in the CSV file |
commentmarker | the character that marks the beginning of a comment |
quoteMarker | the character that is used to quote the sentences in the CSV file |
alloc | the allocator used by all the methods |
gum::learning::DBInitializerFromCSV< ALLOC >::DBInitializerFromCSV | ( | const DBInitializerFromCSV< ALLOC > & | from | ) |
copy constructor
the new initializer points to the same file as from, but it reparses it from scratch.
gum::learning::DBInitializerFromCSV< ALLOC >::DBInitializerFromCSV | ( | const DBInitializerFromCSV< ALLOC > & | from, |
const allocator_type & | alloc | ||
) |
copy constructor with a given allocator
the new initializer points to the same file as from, but it reparses it from scratch.
gum::learning::DBInitializerFromCSV< ALLOC >::DBInitializerFromCSV | ( | DBInitializerFromCSV< ALLOC > && | from | ) |
move constructor
gum::learning::DBInitializerFromCSV< ALLOC >::DBInitializerFromCSV | ( | DBInitializerFromCSV< ALLOC > && | from, |
const allocator_type & | alloc | ||
) |
move constructor with a given allocator
|
virtual |
destructor
|
virtual |
virtual copy constructor
Implements gum::learning::IDBInitializer< ALLOC >.
|
virtual |
virtual copy constructor with a given allocator
Implements gum::learning::IDBInitializer< ALLOC >.
|
protectedvirtualinherited |
asks the child class for the content of the current row using dbcells
If the child class parses DBRows, this method should be overloaded
|
finalprotectedvirtual |
returns the content of the current row using strings
Reimplemented from gum::learning::IDBInitializer< ALLOC >.
|
inherited |
fills the rows of the database table
This method may raise exceptions when trying to insert new rows into the database table. See Method insertRow() of the database table.
|
inherited |
returns the allocator used
|
finalprotectedvirtual |
indicates whether there is a next row to read (and point on it)
Implements gum::learning::IDBInitializer< ALLOC >.
DBInitializerFromCSV< ALLOC >& gum::learning::DBInitializerFromCSV< ALLOC >::operator= | ( | const DBInitializerFromCSV< ALLOC > & | from | ) |
copy operator
the initializer points to the same file as from, but it reparses it from scratch.
DBInitializerFromCSV< ALLOC >& gum::learning::DBInitializerFromCSV< ALLOC >::operator= | ( | DBInitializerFromCSV< ALLOC > && | from | ) |
move operator
the initializer points to the same file as from, but it reparses it from scratch.
|
inherited |
This method indicates which column filling raised an exception, if any, during the execution of fillDatabase.
|
inherited |
returns the names of the variables in the input dataset
|
finalprotectedvirtual |
returns the names of the variables
Implements gum::learning::IDBInitializer< ALLOC >.