46 INLINE
const std::vector< std::size_t >&
52 INLINE
const std::vector< std::string >&
73 "Variable " << var_name
74 <<
" could not be found in the database");
80 INLINE
const std::string&
86 "Variable of Id " <<
id 87 <<
" could not be found in the database");
100 INLINE
const std::vector< std::string >&
163 const double new_weight) {
239 "You must use the 3off2 algorithm before selecting " 249 "You must use the 3off2 algorithm before selecting " 259 "You must use the 3off2 algorithm before selecting " 260 <<
"the NoCorr score");
269 "You must use the 3off2 algorithm before selecting " 270 <<
"the latentVariables method");
343 const std::string& head) {
349 const std::string& head) {
382 const std::string& head) {
388 const std::string& head) {
409 const std::string& head) {
415 const std::string& head) {
438 const std::vector< std::vector< std::string > >& slices) {
441 for (
const auto& slice : slices) {
442 for (
const auto& name : slice) {
520 "genericBNLearner getAprioriType does " 521 "not support yet this apriori");
531 INLINE
const std::vector< std::size_t >&
537 INLINE
const std::vector< std::pair< std::size_t, std::size_t > >&
AlgoType __selected_algo
the selected learning algorithm
void setMaxIndegree(Size max_indegree)
sets the max indegree
void useScoreBIC()
indicate that we wish to use a BIC score
const T2 & second(const T1 &first) const
Returns the second value of a pair given its first value.
bool hasMissingValues() const
returns true if the learner's database has missing values
Database __score_database
the database to be used by the scores and parameter estimators
std::size_t size() const
returns the number of records in the database
void addEdge(const Edge &edge)
assign a new forbidden arc
CorrectedMutualInformation ::KModeTypes __3off2_kmode
the penalty used in 3off2
const std::string & __getAprioriType() const
returns the type (as a string) of a given apriori
double __EMepsilon
epsilon for EM. if espilon=0.0 : no EM
void setEdges(const EdgeSet &set)
assign a set of forbidden arcs
void addArc(const Arc &arc)
assign a new forbidden arc
void setDatabaseWeight(const double new_weight)
assign a weight to all the rows of the learning database so that the sum of their weights is equal to...
void clearDatabaseRanges()
reset the ranges to the one range corresponding to the whole database
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
const T1 & first(const T2 &second) const
Returns the first value of a pair given its second value.
const std::vector< std::string > & missingSymbols() const
returns the set of missing symbols taken into account
void setRecordWeight(const std::size_t i, const double weight)
sets the weight of the ith record of the database
void set3off2Behaviour()
Sets the orientation phase to follow the one of the 3off2 algorithm.
DBVector< std::size_t > columnsFromVariableName(const std::string &name) const
returns the indices of all the columns whose name is passed in argument
void addMandatoryArc(const Arc &arc)
void setTabuListSize(Size new_size)
sets the size of the tabu list
void setArcs(const ArcSet &set)
assign a set of forbidden arcs
StructuralConstraintSliceOrder __constraint_SliceOrder
the constraint for 2TBNs
void setMaxIndegree(Size max_indegree, bool update_all_node=false)
resets the default max indegree and possibly updates the indegree of all nodes
void addArc(const Arc &arc)
assign a new forbidden arc
Miic __miic_3off2
the 3off2 algorithm
void setOrder(const Sequence< NodeId > &order)
sets the order on the variables
void setInitialDAG(const DAG &)
sets an initial DAG structure
std::size_t size() const noexcept
returns the number of records (rows) in the database
const std::string & nameFromId(NodeId id) const
returns the variable name corresponding to a given node id
void setPossibleSkeleton(const UndiGraph &skeleton)
assign a set of forbidden edges
const DBVector< std::string > & missingSymbols() const
returns the set of missing symbols
DatabaseTable __database
the database itself
const std::vector< std::size_t > & domainSizes() const
returns the domain sizes of the variables
void use3off2()
indicate that we wish to use 3off2
void useNoApriori()
use no apriori
double epsilon() const
Get the value of epsilon.
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
void setArcs(const ArcSet &set)
assign a set of forbidden arcs
void useScoreK2()
indicate that we wish to use a K2 score
void setWeight(const std::size_t i, const double weight)
sets the weight of the ith record
const std::vector< Arc > latentVariables() const
get the list of arcs hiding latent variables
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
void setMiicBehaviour()
Sets the orientation phase to follow the one of the MIIC algorithm.
std::size_t nbRows() const
returns the number of records in the database
const std::vector< std::string > & names() const
returns the names of the variables in the database
AprioriType __apriori_type
the a priori selected for the score and parameters
NodeId idFromName(const std::string &var_name) const
returns the node id corresponding to a variable name
the internal apriori for the BDeu score (N' / (r_i * q_i)BDeu is a BD score with a N'/(r_i * q_i) apr...
The class for generic Hash Tables.
void useScoreLog2Likelihood()
indicate that we wish to use a Log2Likelihood score
A dirichlet priori: computes its N'_ijk from a database.
const std::vector< Arc > latentVariables() const
get the list of arcs hiding latent variables
DAG __initial_dag
an initial DAG given to learners
void useNML()
indicate that we wish to use the NML correction for 3off2
StructuralConstraintMandatoryArcs __constraint_MandatoryArcs
the constraint on forbidden arcs
void setMandatoryArcs(const ArcSet &set)
assign a set of forbidden arcs
const EdgeSet & edges() const
returns the set of edges stored within the EdgeGraphPart
void eraseMandatoryArc(const Arc &arc)
LocalSearchWithTabuList __local_search_with_tabu_list
the local search with tabu list algorithm
void erasePossibleEdge(const Edge &edge)
bool hasMissingValues() const
indicates whether the database contains some missing values
void eraseArc(const Arc &arc)
remove a forbidden arc
double databaseWeight() const
returns the weight of the whole database
The base class for all directed edgesThis class is used as a basis for manipulating all directed edge...
double recordWeight(const std::size_t i) const
returns the weight of the ith record
void useNoCorr()
indicate that we wish to use the NoCorr correction for 3off2
StructuralConstraintTabuList __constraint_TabuList
the constraint for tabu lists
std::string __apriori_dbname
the filename for the Dirichlet a priori, if any
void addPossibleEdge(const Edge &edge)
StructuralConstraintPossibleEdges __constraint_PossibleEdges
the constraint on possible Edges
std::size_t nbRows() const noexcept
returns the number of records (rows) in the database
void useLocalSearchWithTabuList(Size tabu_size=100, Size nb_decrease=2)
indicate that we wish to use a local search with tabu list
const std::string & nameFromId(NodeId id) const
returns the variable name corresponding to a given node id
const DatabaseTable & databaseTable() const
returns the internal database table
void __setAprioriWeight(double weight)
sets the apriori weight
std::string checkScoreAprioriCompatibility()
checks whether the current score and apriori are compatible
void eraseForbiddenArc(const Arc &arc)
double weight(const std::size_t i) const
returns the weight of the ith record
void useGreedyHillClimbing()
indicate that we wish to use a greedy hill climbing algorithm
void eraseArc(const Arc &arc)
remove a forbidden arc
std::vector< std::pair< std::size_t, std::size_t > > __ranges
the set of rows' ranges within the database in which learning is done
void useAprioriSmoothing(double weight=1)
use the apriori smoothing
double weight() const
returns the weight of the whole database
const Bijection< NodeId, std::size_t > & nodeId2Columns() const
returns the mapping between node ids and their columns in the database
The class representing a tabular database as used by learning tasks.
void useScoreAIC()
indicate that we wish to use an AIC score
void useK2(const Sequence< NodeId > &order)
indicate that we wish to use K2
StructuralConstraintIndegree __constraint_Indegree
the constraint for indegrees
ScoreType __score_type
the score selected for learning
const std::vector< std::pair< std::size_t, std::size_t > > & databaseRanges() const
returns the current database rows' ranges used for learning
void addForbiddenArc(const Arc &arc)
DBRowGeneratorParser * __parser
the parser used for reading the database
double weight(const std::size_t i) const
returns the weight of the ith record
void setPossibleEdges(const EdgeSet &set)
assign a set of forbidden edges
const std::string & variableName(const std::size_t k) const
returns the name of the kth column of the IDatabaseTable
The base class for all undirected edges.
void useEM(const double epsilon)
use The EM algorithm to learn paramters
DBRowGeneratorParser & parser()
returns the parser for the database
void useAprioriDirichlet(const std::string &filename, double weight=1)
use the Dirichlet apriori
double __apriori_weight
the weight of the apriori
void eraseEdge(const Edge &edge)
remove a forbidden arc
const std::vector< std::size_t > & domainSizes() const
returns the domain sizes of the variables in the database
Base class for undirected graphs.
void setDatabaseWeight(const double new_weight)
assign a weight to all the rows of the database so that the sum of their weights is equal to new_weig...
the smooth a priori: adds a weight w to all the countings
void setAllRowsWeight(const double new_weight)
assign a given weight to all the rows of the database
std::vector< std::size_t > __domain_sizes
the domain sizes of the variables (useful to speed-up computations)
void setForbiddenArcs(const ArcSet &set)
assign a set of forbidden arcs
Bijection< NodeId, std::size_t > __nodeId2cols
a bijection assigning to each variable name its NodeId
void useAprioriBDeu(double weight=1)
use the BDeu apriori
std::size_t Size
In aGrUM, hashed values are unsigned long int.
const DatabaseTable & database() const
returns the database used by the BNLearner
StructuralConstraintForbiddenArcs __constraint_ForbiddenArcs
the constraint on forbidden arcs
void setSliceOrder(const NodeProperty< NodeId > &slice_order)
sets a partial order on the nodes
value_type & insert(const Key &key, const Val &val)
Adds a new element (actually a copy of this element) into the hash table.
const std::vector< std::string > & names() const
returns the names of the variables in the database
const DBVector< std::string > & variableNames() const noexcept
returns the variable names for all the columns of the database
void useMIIC()
indicate that we wish to use MIIC
the class used to read a row in the database and to transform it into a set of DBRow instances that c...
void useScoreBD()
indicate that we wish to use a BD score
void useMDL()
indicate that we wish to use the MDL correction for 3off2
void setMaxNbDecreasingChanges(Size nb)
set the max number of changes decreasing the score that we allow to apply
void useScoreBDeu()
indicate that we wish to use a BDeu score
Size NodeId
Type for node ids.
the no a priori class: corresponds to 0 weight-sample
NodeId idFromName(const std::string &var_name) const
returns the node id corresponding to a variable name
#define GUM_ERROR(type, msg)
void setWeight(const std::size_t i, const double weight)
assigns a given weight to the ith row of the database
the structural constraint imposing a partial order over nodes