87#ifndef GUM_BN_DATABASE_GENERATOR
88#define GUM_BN_DATABASE_GENERATOR
99 template <
typename GUM_SCALAR >
162 void toCSV(
const std::string& csvFileURL,
163 bool useLabels =
true,
165 std::string csvSeparator =
",",
166 bool checkOnAppend =
false)
const;
173 std::vector< std::vector< Idx > >
database()
const;
188 void setVarOrderFromCSV(
const std::string& csvFileURL,
const std::string& csvSeparator =
",");
200 std::vector< Idx >
varOrder()
const;
209 const BayesNet< GUM_SCALAR >&
bn(
void) {
return _bn_; };
216 const BayesNet< GUM_SCALAR >&
_bn_;
242 const std::string& csvSeparator =
",")
const;
246 const std::string& csvSeparator =
",")
const;
256#ifndef GUM_NO_EXTERN_TEMPLATE_CLASS
Class representing Bayesian networks.
Base class for discrete random variable.
Class for assigning/browsing values to tuples of discrete variables.
Notification for progress using listener.
bool _drawnSamples_
whether drawSamples has been already called.
std::vector< Idx > varOrder() const
returns variable order indexes
std::string samplesLabelAt(Idx row, Idx col) const
generate and stock database, returns log2likelihood using ProgressNotifier as notification
DatabaseTable toDatabaseTable(bool useLabels=true) const
generates a DatabaseVectInRAM
void setVarOrderFromCSV(const std::string &csvFileURL, const std::string &csvSeparator=",")
change columns order according to a csv file
Size samplesNbRows() const
generate and stock database, returns log2likelihood using ProgressNotifier as notification
BNDatabaseGenerator(BNDatabaseGenerator &&)=delete
std::string _label_(const std::vector< Idx > &row, const DiscreteVariable &v, Idx i) const
return the final string for a label (taking into account the behavior for DiscretizedVariable) from a...
BNDatabaseGenerator & operator=(const BNDatabaseGenerator &)=delete
std::vector< std::vector< Idx > > database() const
generates database according to bn into a std::vector
void setDiscretizedLabelModeRandom()
set the behaviour of sampling for discretized variable to uniformly draw double value
BNDatabaseGenerator & operator=(BNDatabaseGenerator &&)=delete
Idx samplesAt(Idx row, Idx col) const
generate and stock database, returns log2likelihood using ProgressNotifier as notification
double _log2likelihood_
log2Likelihood of generated samples
const BayesNet< GUM_SCALAR > & bn(void)
return const ref to the Bayes Net
BNDatabaseGenerator(const BayesNet< GUM_SCALAR > &bn)
default constructor
void setDiscretizedLabelModeInterval()
set the behaviour of sampling for discretized variable to select the label : "[min,...
Bijection< std::string, NodeId > _names2ids_
bijection nodes names
std::vector< std::vector< Idx > > _database_
generated database
DiscretizedLabelMode _discretizedLabelMode_
BNDatabaseGenerator(const BNDatabaseGenerator &)=delete
Size samplesNbCols() const
generate and stock database, returns log2likelihood using ProgressNotifier as notification
const BayesNet< GUM_SCALAR > & _bn_
Bayesian network.
void setAntiTopologicalVarOrder()
set columns in antiTopoligical order
double log2likelihood() const
returns log2Likelihood of generated samples
void setTopologicalVarOrder()
set columns in topoligical order
void setDiscretizedLabelModeMedian()
set the behaviour of sampling for discretized variable to deterministic select double median of inter...
double drawSamples(Size nbSamples)
generate and stock database, returns log2likelihood using ProgressNotifier as notification
std::vector< Idx > _varOrder_
variable order in generated database
std::vector< std::string > varOrderNames() const
returns variable order.
std::vector< Idx > _varOrderFromCSV_(const std::string &csvFileURL, const std::string &csvSeparator=",") const
returns varOrder from a csv file
Size _nbVars_
number of variables
void setVarOrder(const std::vector< Idx > &varOrder)
change columns order
void toCSV(const std::string &csvFileURL, bool useLabels=true, bool append=false, std::string csvSeparator=",", bool checkOnAppend=false) const
generates csv representing the generated database
void setRandomVarOrder()
set columns in random order
~BNDatabaseGenerator()
destructor
The class representing a tabular database as used by learning tasks.
The class representing a tabular database stored in RAM.
std::size_t Size
In aGrUM, hashed values are unsigned long int.
Size Idx
Type for indexes.
include the inlined functions if necessary
gum is the global namespace for all aGrUM entities
priority queues (in which an element cannot appear more than once)