![]() |
aGrUM 2.3.2
a C++ library for (probabilistic) graphical models
|
The class for initializing DatabaseTable and RawDatabaseTable instances from CSV files. More...
#include <agrum/base/database/DBInitializerFromCSV.h>
Public Types | |
| enum class | InputType : char { STRING , DBCELL } |
| the enumeration indicating the type of the data the IDBInitializer expects as input data More... | |
Public Member Functions | |
Constructors / Destructors | |
| DBInitializerFromCSV (const std::string filename, bool fileContainsNames=true, const std::string delimiter=",", const char commentmarker='#', const char quoteMarker='"') | |
| default constructor | |
| DBInitializerFromCSV (const DBInitializerFromCSV &from) | |
| copy constructor | |
| DBInitializerFromCSV (DBInitializerFromCSV &&from) | |
| move constructor | |
| virtual DBInitializerFromCSV * | clone () const |
| virtual copy constructor | |
| virtual | ~DBInitializerFromCSV () |
| destructor | |
Operators | |
| DBInitializerFromCSV & | operator= (const DBInitializerFromCSV &from) |
| copy operator | |
| DBInitializerFromCSV & | operator= (DBInitializerFromCSV &&from) |
| move operator | |
Accessors / Modifiers | |
| const std::vector< std::string > & | variableNames () |
| returns the names of the variables in the input dataset | |
| template<class DATABASE> | |
| void | fillDatabase (DATABASE &database, const bool retry_insertion=false) |
| fills the rows of the database table | |
| std::size_t | throwingColumn () const |
| This method indicates which column filling raised an exception, if any, during the execution of fillDatabase. | |
Protected Member Functions | |
| virtual std::vector< std::string > | variableNames_ () final |
| returns the names of the variables | |
| virtual const std::vector< std::string > & | currentStringRow_ () final |
| returns the content of the current row using strings | |
| virtual bool | nextRow_ () final |
| indicates whether there is a next row to read (and point on it) | |
| virtual const DBRow< DBCell > & | currentDBCellRow_ () |
| asks the child class for the content of the current row using dbcells | |
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 151 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 139 of file IDBInitializer.h.
| gum::learning::DBInitializerFromCSV::DBInitializerFromCSV | ( | const std::string | filename, |
| bool | fileContainsNames = true, | ||
| const std::string | delimiter = ",", | ||
| const char | commentmarker = '#', | ||
| const char | quoteMarker = '"' ) |
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 |
Referenced by DBInitializerFromCSV(), DBInitializerFromCSV(), clone(), operator=(), and operator=().
| gum::learning::DBInitializerFromCSV::DBInitializerFromCSV | ( | const DBInitializerFromCSV & | from | ) |
copy constructor
the new initializer points to the same file as from, but it reparses it from scratch.
References DBInitializerFromCSV().
| gum::learning::DBInitializerFromCSV::DBInitializerFromCSV | ( | DBInitializerFromCSV && | from | ) |
|
virtual |
destructor
|
virtual |
virtual copy constructor
Implements gum::learning::IDBInitializer.
References DBInitializerFromCSV().
|
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.
References currentStringRow_().
Referenced by currentStringRow_().
|
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.
Referenced by gum::learning::IBNLearner::Database::Database(), gum::learning::IBNLearner::Database::Database(), gum::learning::readFile(), and gum::learning::IBNLearner::readFile_().
|
finalprotectedvirtual |
indicates whether there is a next row to read (and point on it)
Implements gum::learning::IDBInitializer.
References nextRow_().
Referenced by nextRow_().
| DBInitializerFromCSV & gum::learning::DBInitializerFromCSV::operator= | ( | const DBInitializerFromCSV & | from | ) |
copy operator
the initializer points to the same file as from, but it reparses it from scratch.
References DBInitializerFromCSV().
| DBInitializerFromCSV & gum::learning::DBInitializerFromCSV::operator= | ( | DBInitializerFromCSV && | from | ) |
move operator
the initializer points to the same file as from, but it reparses it from scratch.
References DBInitializerFromCSV().
|
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
Referenced by gum::learning::IBNLearner::Database::Database(), gum::learning::IBNLearner::Database::Database(), gum::learning::readFile(), and gum::learning::IBNLearner::readFile_().
|
finalprotectedvirtual |
returns the names of the variables
Implements gum::learning::IDBInitializer.