71 const auto& var_names =
_database_.variableNames();
72 const std::size_t nb_vars = var_names.size();
75 for (std::size_t i = 0; i < nb_vars; ++i) {
84 const std::vector< std::string >& missing_symbols,
85 const bool induceTypes) :
89 for (
const auto& [first, second]:
_database_.betterTranslators()) {
100 const std::vector< std::string >& missing_symbols) {
105 std::size_t prior_nb_vars = prior_names.size();
107 for (
auto i = std::size_t(0); i < prior_nb_vars; ++i)
108 prior_names2col.
insert(prior_names[i], i);
114 "the a prior database has fewer variables "
115 "than the observed database")
121 const std::size_t score_nb_vars = score_names.size();
123 for (
auto i = std::size_t(0); i < score_nb_vars; ++i) {
125 mapping.
insert(i, prior_names2col[score_names[i]]);
128 "Variable " << score_names[i]
129 <<
" of the observed database does not belong to the "
135 for (
auto i = std::size_t(0); i < score_nb_vars; ++i) {
137 _database_.insertTranslator(var, mapping[i], missing_symbols);
201 const std::vector< std::string >& missing_symbols,
202 const bool induceTypes) :
377 dag2BN_ = std::move(from.dag2BN_);
381 ranges_ = std::move(from.ranges_);
394 if (
auto filename_size =
Size(filename.size()); filename_size < 4) {
396 "IBNLearner could not determine the "
397 "file type of the database '"
401 std::string extension = filename.substr(filename.size() - 4);
402 std::transform(extension.begin(), extension.end(), extension.begin(), ::tolower);
404 if (extension !=
".csv") {
406 "IBNLearner does not support yet this type ('" << extension
414 const std::size_t nb_vars = var_names.size();
418 for (std::size_t i = 0; i < nb_vars; ++i) {
432 if (
auto filename_size =
Size(filename.size()); filename_size < 4) {
434 "IBNLearner could not determine the "
435 "file type of the database")
438 std::string extension(filename.substr(filename.size() - 4));
439 std::transform(extension.begin(), extension.end(), extension.begin(), ::tolower);
441 if (extension !=
".csv") {
447 const std::vector< std::string >& missing_symbols) {
454 const std::size_t nb_vars = var_names.size();
458 for (std::size_t i = 0; i < nb_vars; ++i) {
537 if (old_score !=
nullptr)
delete old_score;
545 bool take_into_account_score) {
551 if (take_into_account_score && (
score_ !=
nullptr)) {
569 "IBNLearner does not support " <<
"yet this parameter estimator")
579 return param_estimator;
626 if (possible_edges.
empty()) {
628 for (
NodeId j = 0; j < i; ++j) {
634 for (
const auto& edge: possible_edges) {
635 mgraph.
addEdge(edge.first(), edge.second());
645 for (
const auto& arc: mandatory_arcs) {
646 mandatoryGraph.
addArc(arc.tail(), arc.head());
654 for (
const auto& arc: forbidden_arcs) {
655 forbiddenGraph.
addArc(arc.tail(), arc.head());
661 for (
const auto& [n1, r1]: sliceOrder) {
662 for (
const auto& [n2, r2]: copyOrder) {
664 forbiddenGraph.
addArc(n1, n2);
666 }
else if (r2 > r1) {
667 forbiddenGraph.
addArc(n2, n1);
676 for (
auto iter1 = totalOrder.begin(); iter1 != totalOrder.end(); ++iter1) {
677 const auto node1 = *iter1;
678 for (
auto iter2 = iter1 + 1; iter2 != totalOrder.end(); ++iter2) {
679 forbiddenGraph.
addArc(*iter2, node1);
684 for (
const auto node2: mgraph.
nodes()) {
685 if (node != node2) { forbiddenGraph.
addArc(node2, node); }
690 for (
const auto node2: mgraph.
nodes()) {
691 if (node != node2) { forbiddenGraph.
addArc(node, node2); }
698 algoMiic_.setMandatoryGraph(mandatoryGraph);
699 algoMiic_.setForbiddenGraph(forbiddenGraph);
722 if (possible_edges.
empty()) {
724 for (
NodeId j = 0; j < i; ++j) {
729 for (
const auto& edge: possible_edges) {
730 mgraph.
addEdge(edge.first(), edge.second());
735 mandatoryGraph.
addArc(arc.tail(), arc.head());
736 forbiddenGraph.
addArc(arc.head(), arc.tail());
739 forbiddenGraph.
addArc(arc.tail(), arc.head());
744 for (
const auto& [n1, r1]: sliceOrder) {
745 for (
const auto& [n2, r2]: copyOrder) {
747 forbiddenGraph.
addArc(n1, n2);
748 }
else if (r2 > r1) {
749 forbiddenGraph.
addArc(n2, n1);
756 for (
auto iter1 = totalOrder.begin(); iter1 != totalOrder.end(); ++iter1) {
757 for (
auto iter2 = iter1 + 1; iter2 != totalOrder.end(); ++iter2) {
758 forbiddenGraph.
addArc(*iter2, *iter1);
763 for (
const auto node2: mgraph.
nodes()) {
764 if (node != node2) { forbiddenGraph.
addArc(node2, node); }
768 for (
const auto node2: mgraph.
nodes()) {
769 if (node != node2) { forbiddenGraph.
addArc(node, node2); }
791 algoPC_.setMandatoryGraph(mandatoryGraph);
792 algoPC_.setForbiddenGraph(forbiddenGraph);
815 if (possible_edges.
empty()) {
817 for (
NodeId j = 0; j < i; ++j) {
822 for (
const auto& edge: possible_edges) {
823 mgraph.
addEdge(edge.first(), edge.second());
828 mandatoryGraph.
addArc(arc.tail(), arc.head());
829 forbiddenGraph.
addArc(arc.head(), arc.tail());
832 forbiddenGraph.
addArc(arc.tail(), arc.head());
837 for (
const auto& [n1, r1]: sliceOrder) {
838 for (
const auto& [n2, r2]: copyOrder) {
840 forbiddenGraph.
addArc(n1, n2);
841 }
else if (r2 > r1) {
842 forbiddenGraph.
addArc(n2, n1);
849 for (
auto iter1 = totalOrder.begin(); iter1 != totalOrder.end(); ++iter1) {
850 for (
auto iter2 = iter1 + 1; iter2 != totalOrder.end(); ++iter2) {
851 forbiddenGraph.
addArc(*iter2, *iter1);
856 for (
const auto node2: mgraph.
nodes()) {
857 if (node != node2) { forbiddenGraph.
addArc(node2, node); }
861 for (
const auto node2: mgraph.
nodes()) {
862 if (node != node2) { forbiddenGraph.
addArc(node, node2); }
883 algoFCI_.setMandatoryGraph(mandatoryGraph);
884 algoFCI_.setForbiddenGraph(forbiddenGraph);
897 "Score-based algorithms do not build PDAG. Please use a constraint-based "
903 "For the moment, the BNLearner is unable to learn "
904 <<
"structures with missing values in databases")
910 return algoPC_.learnPDAG(mgraph);
928 for (
const auto i: pdag) {
940 "For the moment, the BNLearner is unable to learn "
941 <<
"structures with missing values in databases")
950 for (
const auto i: pag) {
960 for (
const auto i: dag) {
980 "The BNLearner's corrected mutual information class does "
981 <<
"not implement yet this correction : " <<
int(
kmodeMiic_))
992 "For the moment, the BNLearner is unable to cope "
993 "with missing values in databases")
1004 init_graph.
addArc(arc.tail(), arc.head());
1016 return algoPC_.learnDAG(mgraph);
1046 invariable_constraints;
1063 variable_constraints;
1067 invariable_constraints,
1068 variable_constraints);
1090 invariable_constraints;
1107 variable_constraints;
1111 invariable_constraints,
1112 variable_constraints);
1132 invariable_constraints;
1149 variable_constraints;
1153 invariable_constraints,
1154 variable_constraints);
1169 invariable_constraints;
1188 variable_constraints;
1193 invariable_constraints,
1194 variable_constraints);
1213 invariable_constraints;
1229 const ArcSet& mandatory_arcs
1232 bool order_compatible =
true;
1234 for (
const auto& arc: mandatory_arcs) {
1235 if (order.
pos(arc.tail()) >= order.
pos(arc.head())) {
1236 order_compatible =
false;
1241 if (order_compatible) {
1243 variable_constraints;
1247 invariable_constraints,
1248 variable_constraints);
1250 return algoK2_.learnStructure(selector, init_graph);
1253 variable_constraints;
1257 invariable_constraints,
1258 variable_constraints);
1260 return algoK2_.learnStructure(selector, init_graph);
1266 "the learnDAG method has not been implemented for this "
1267 "learning algorithm")
1293 default :
return "IBNLearner does not support yet this score";
1298 std::pair< std::size_t, std::size_t >
1300 const std::size_t k_fold) {
1303 if (learning_fold >= k_fold) {
1305 "In " << k_fold <<
"-fold cross validation, the learning "
1306 <<
"fold should be strictly lower than " << k_fold
1307 <<
" but, here, it is equal to " << learning_fold)
1310 const std::size_t db_size =
scoreDatabase_.databaseTable().nbRows();
1311 if (k_fold >= db_size) {
1313 "In " << k_fold <<
"-fold cross validation, the database's "
1314 <<
"size should be strictly greater than " << k_fold
1315 <<
" but, here, the database has only " << db_size <<
"rows")
1319 const std::size_t foldSize = db_size / k_fold;
1320 const std::size_t unfold_deb = learning_fold * foldSize;
1321 const std::size_t unfold_end = unfold_deb + foldSize;
1324 if (learning_fold == std::size_t(0)) {
1325 ranges_.push_back(std::pair< std::size_t, std::size_t >(unfold_end, db_size));
1327 ranges_.push_back(std::pair< std::size_t, std::size_t >(std::size_t(0), unfold_deb));
1329 if (learning_fold != k_fold - 1) {
1330 ranges_.push_back(std::pair< std::size_t, std::size_t >(unfold_end, db_size));
1334 return std::pair< std::size_t, std::size_t >(unfold_deb, unfold_end);
1337 std::pair< double, double >
1342 return chi2score.
statistics(id1, id2, knowing);
1346 std::string_view name2,
1347 const std::vector< std::string >& knowing) {
1348 std::vector< NodeId > knowingIds;
1349 std::transform(knowing.begin(),
1351 std::back_inserter(knowingIds),
1352 [
this](
const std::string& c) { return this->idFromName(c); });
1356 std::pair< double, double >
1360 return g2score.
statistics(id1, id2, knowing);
1364 std::string_view name2,
1365 const std::vector< std::string >& knowing) {
1366 std::vector< NodeId > knowingIds;
1367 std::transform(knowing.begin(),
1369 std::back_inserter(knowingIds),
1370 [
this](
const std::string& c) { return this->idFromName(c); });
1375 const std::vector< NodeId >& knowing) {
1379 std::vector< NodeId > total(vars);
1380 total.insert(total.end(), knowing.begin(), knowing.end());
1382 if (knowing.size() == (
Size)0) {
1386 return LLtotal - LLknw;
1391 const std::vector< std::string >& knowing) {
1392 std::vector< NodeId > ids;
1393 std::vector< NodeId > knowingIds;
1395 auto mapper = [
this](
const std::string& c) {
return this->
idFromName(c); };
1397 std::transform(vars.begin(), vars.end(), std::back_inserter(ids), mapper);
1398 std::transform(knowing.begin(), knowing.end(), std::back_inserter(knowingIds), mapper);
1405 const std::vector< NodeId >& knowing) {
1415 case NML : cmi.
useNML();
break;
1421 "The BNLearner's corrected mutual information class does "
1422 <<
"not implement yet this correction : " <<
int(
kmodeMiic_))
1429 std::string_view var2,
1430 const std::vector< std::string >& knowing) {
1431 std::vector< NodeId > knowingIds;
1433 auto mapper = [
this](
const std::string& c) {
return this->
idFromName(c); };
1435 std::transform(knowing.begin(), knowing.end(), std::back_inserter(knowingIds), mapper);
1442 const std::vector< NodeId >& knowing) {
1452 std::string_view var2,
1453 const std::vector< std::string >& knowing) {
1454 std::vector< NodeId > knowingIds;
1456 auto mapper = [
this](
const std::string& c) {
return this->
idFromName(c); };
1458 std::transform(knowing.begin(), knowing.end(), std::back_inserter(knowingIds), mapper);
1467 return score_->score(var, knowing);
1471 auto mapper = [
this](
const std::string& c) {
return this->
idFromName(c); };
1474 std::vector< NodeId > knowingIds;
1475 knowingIds.reserve(knowing.size());
1476 std::transform(knowing.begin(), knowing.end(), std::back_inserter(knowingIds), mapper);
1478 return score(
id, knowingIds);
1484 "BNLearner cannot compute pseudo-counts with missing values in the database")
1493 return count.
get(vars);
1497 std::vector< NodeId > ids;
1499 auto mapper = [
this](
const std::string& c) {
return this->
idFromName(c); };
1501 std::transform(vars.begin(), vars.end(), std::back_inserter(ids), mapper);
1507 const std::vector< std::pair< std::size_t, std::size_t > >& new_ranges) {
1510 score.setRanges(new_ranges);
A listener that allows BNLearner to be used as a proxy for its inner algorithms.
A class for generic framework of learning algorithms that can easily be used.
A pack of learning algorithms that can easily be used.
virtual void eraseArc(const Arc &arc)
removes an arc from the ArcGraphPart
void addArc(NodeId tail, NodeId head) final
insert a new arc into the directed graph
Base class for all oriented graphs.
void addArc(const NodeId tail, const NodeId head) override
insert a new arc into the directed graph
Base class for all aGrUM's exceptions.
The class for generic Hash Tables.
value_type & insert(const Key &key, const Val &val)
Adds a new element (actually a copy of this element) into the hash table.
IApproximationSchemeConfiguration()
Class constructors.
Exception: at least one argument passed to a function is not what was expected.
Error: The database contains some missing values.
Error: A name of variable is not found in the database.
Base class for mixed graphs.
const NodeGraphPart & nodes() const
return *this as a NodeGraphPart
bool exists(const NodeId id) const
alias for existsNode
virtual void addNodeWithId(const NodeId id)
try to insert a node with the given id
Exception : there is something wrong with an implementation.
Exception : operation not allowed.
Exception : out of bound.
Partial Ancestral Graph: undirected topology with endpoint marks.
Base class for partially directed acyclic graphs.
Idx pos(const Key &key) const
bool empty() const noexcept
Indicates whether the set is the empty set.
aGrUM's Tensor is a multi-dimensional array with tensor operators.
bool isGumNumberOfThreadsOverriden() const override
indicates whether the class containing this ThreadNumberManager set its own number of threads
Size getNumberOfThreads() const override
returns the current max number of threads used by the class containing this ThreadNumberManager
ThreadNumberManager(Size nb_threads=0)
default constructor
ThreadNumberManager & operator=(const ThreadNumberManager &from)
copy operator
void addEdge(NodeId first, NodeId second) override
insert a new edge into the undirected graph
Base class for every random variable.
A class that redirects gum_signal from algorithms to the listeners of BNLearn.
@ Sorted
descending p-value order (strongest evidence first)
@ Standard
process triples in natural traversal order
The class for initializing DatabaseTable and RawDatabaseTable instances from CSV files.
the class used to read a row in the database and to transform it into a set of DBRow instances that c...
The class used to pack sets of generators.
The databases' cell translators for labelized variables.
the class for packing together the translators used to preprocess the datasets
std::size_t insertTranslator(const DBTranslator &translator, const std::size_t column, const bool unique_column=true)
inserts a new translator at the end of the translator set
The class representing a tabular database as used by learning tasks.
void setVariableNames(const std::vector< std::string > &names, const bool from_external_object=true) override
sets the names of the variables
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...
The mecanism to compute the next available graph changes for directed structure learning search algor...
void useArcAdditions(bool use)
sets whether or not the selector allows the application of arc additions
void useArcDeletions(bool use)
sets whether or not the selector allows the application of arc deletions
void useArcReversals(bool use)
sets whether or not the selector allows the application of arc reversals
void useArcTriangleDeletions(bool use)
sets whether or not the selector allows the application of arc triangle deletions
a helper to easily read databases
const DatabaseTable & databaseTable() const
returns the internal database table
std::vector< std::size_t > _domain_sizes_
the domain sizes of the variables (useful to speed-up computations)
DatabaseTable _database_
the database itself
Bijection< NodeId, std::size_t > _nodeId2cols_
a bijection assigning to each variable name its NodeId
Database(std::string_view file, const std::vector< std::string > &missing_symbols, const bool induceTypes=false)
default constructor
const Bijection< NodeId, std::size_t > & nodeId2Columns() const
returns the mapping between node ids and their columns in the database
Database & operator=(const Database &from)
copy operator
DBRowGeneratorParser * _parser_
the parser used for reading the database
StructuralConstraintPossibleEdges constraintPossibleEdges_
the constraint on possible Edges
MixedGraph preparePC_()
prepares the initial graph and independence test for PC
StructuralConstraintNoParentNodes constraintNoParentNodes_
the constraint on no parent nodes
BNLearnerPriorType priorType_
the a priorselected for the score and parameters
PAG learnPAG()
learn a PAG — only valid when useFCI() has been called
std::string priorDbname_
the filename for the Dirichlet a priori, if any
double priorWeight_
the weight of the prior
double noiseEM_
the noise factor (in (0,1)) used by EM for perturbing the CPT during init
std::vector< std::pair< std::size_t, std::size_t > > ranges_
the set of rows' ranges within the database in which learning is done
~IBNLearner() override
destructor
std::string checkScorePriorCompatibility() const
checks whether the current score and prior are compatible
GreedyHillClimbing extendedGreedyHillClimbing_
the extended greedy hill climbing
@ EXTENDED_GREEDY_HILL_CLIMBING
@ LOCAL_SEARCH_WITH_TABU_LIST
bool allowArcTriangleDeletions_
whether we allow or not arc deletions during learning
virtual void createPrior_()=0
create the prior used for learning
K2 algoK2_
the K2 algorithm
IndepTestType indepTestTypeFCI_
independence test type for FCI (reuses IndepTestType defined above)
AlgoType selectedAlgo_
the selected learning algorithm
const std::vector< std::pair< std::size_t, std::size_t > > & databaseRanges() const
returns the current database rows' ranges used for learning
bool allowArcAdditions_
whether we allow or not arc additions during learning
double logLikelihood(const std::vector< NodeId > &vars, const std::vector< NodeId > &knowing={})
Return the loglikelihood of vars in the base, conditioned by knowing for the BNLearner.
Database scoreDatabase_
the database to be used by the scores and parameter estimators
ScoreType
an enumeration enabling to select easily the score we wish to use
bool useEM_
a Boolean indicating whether we should use EM for parameter learning or not
DAG2BNLearner dag2BN_
the parametric EM
Prior * prior_
the prior used
void useDatabaseRanges(const std::vector< std::pair< std::size_t, std::size_t > > &new_ranges)
use a new set of database rows' ranges to perform learning
std::pair< double, double > chi2(NodeId id1, NodeId id2, const std::vector< NodeId > &knowing={})
Return the <statistic,pvalue> pair for chi2 test in the database.
CorrectedMutualInformation * mutualInfo_
the selected correction for miic
@ DIRICHLET_FROM_DATABASE
Size nbDecreasingChanges_
StructuralConstraintNoChildrenNodes constraintNoChildrenNodes_
the constraint on no children nodes
static void isCSVFileName_(std::string_view filename)
checks whether the extension of a CSV filename is correct
gum::learning::FCI algoFCI_
the FCI algorithm
ParamEstimatorType paramEstimatorType_
the type of the parameter estimator
ScoreType scoreType_
the score selected for learning
std::pair< double, double > G2(NodeId id1, NodeId id2, const std::vector< NodeId > &knowing={})
Return the <statistic,pvalue> pair for for G2 test in the database.
const ApproximationScheme * currentAlgorithm_
IndependenceTest * indepTestPC_
owned independence test object for PC (rebuilt before each learn call)
DAG learnDag_()
returns the DAG learnt
Database * priorDatabase_
the database used by the Dirichlet a priori
double mutualInformation(NodeId id1, NodeId id2, const std::vector< NodeId > &knowing={})
Return the mutual information of id1 and id2 in the base, conditioned by knowing for the BNLearner.
void createScore_()
create the score used for learning
PriorType getPriorType_() const
returns the type (as a string) of a given prior
double alphaFci_
FCI parameters.
double alphaPc_
PC parameters.
StructuralConstraintIndegree constraintIndegree_
the constraint for indegrees
bool allowArcDeletions_
whether we allow or not arc deletions during learning
PDAG learnPDAG()
learn a partial structure from a file (must have read the db before and must have selected miic)
static DatabaseTable readFile_(std::string_view filename, const std::vector< std::string > &missing_symbols)
reads a file and returns a databaseVectInRam
std::string filename_
the filename database
bool exhaustiveSepSetFci_
bool hasMissingValues() const
returns true if the learner's database has missing values
NodeId idFromName(std::string_view var_name) const
returns the node id corresponding to a variable name
SimpleMiic algoSimpleMiic_
the MIIC algorithm
Score * score_
the score used
StructuralConstraintMandatoryArcs constraintMandatoryArcs_
the constraint on mandatory arcs
Miic algoMiic_
the Constraint MIIC algorithm
void createCorrectedMutualInformation_()
create the Corrected Mutual Information instance for Miic
IndepTestType indepTestTypePC_
StructuralConstraintForbiddenArcs constraintForbiddenArcs_
the constraint on forbidden arcs
StructuralConstraintTotalOrder constraintTotalOrder_
the total order ing constraint
GreedyHillClimbing greedyHillClimbing_
the greedy hill climbing algorithm
DAG learnDAG()
learn a structure from a file (must have read the db before)
double score(NodeId vars, const std::vector< NodeId > &knowing={})
Return the value of the score currently in use by the BNLearner of a variable given a set of other va...
StructuralConstraintTabuList constraintTabuList_
the constraint for tabu lists
DAG initialDag_
an initial DAG given to learners
GreedyThickThinning greedyThickThinning_
the greedy thick-thinning algorithm
MixedGraph prepareFCI_()
prepares the initial graph and independence test for FCI
IBNLearner & operator=(const IBNLearner &)
copy operator
gum::learning::PC algoPC_
the PC algorithm
bool allowArcReversals_
whether we allow or not arc reversals during learning
MixedGraph prepareMiic_()
prepares the initial graph for miic
IBNLearner(std::string_view filename, const std::vector< std::string > &missingSymbols, bool induceTypes=true)
read the database file for the score / parameter estimation and var names
LocalSearchWithTabuList localSearchWithTabuList_
the local search with tabu list algorithm
IndependenceTest * indepTestFCI_
owned independence test object for FCI (rebuilt before each learn call)
std::pair< std::size_t, std::size_t > useCrossValidationFold(const std::size_t learning_fold, const std::size_t k_fold)
sets the ranges of rows to be used for cross-validation learning
ParamEstimator * createParamEstimator_(const DBRowGeneratorParser &parser, bool take_into_account_score=true)
create the parameter estimator used for learning
StructuralConstraintSliceOrder constraintSliceOrder_
the constraint for 2TBNs
const DatabaseTable & database() const
returns the database used by the BNLearner
std::vector< double > rawPseudoCount(const std::vector< NodeId > &vars)
Return the pseudo-counts of NodeIds vars in the base in a raw array.
bool inducedTypes_
the policy for typing variables
CorrectedMutualInformation::KModeTypes kmodeMiic_
the penalty used in MIIC
double correctedMutualInformation(NodeId id1, NodeId id2, const std::vector< NodeId > &knowing={})
Return the mutual information of id1 and id2 in the base, conditioned by knowing for the BNLearner.
bool isConstraintBased() const
indicate if the selected algorithm is constraint-based
void fillDatabase(DATABASE &database, const bool retry_insertion=false)
fills the rows of the database table
const std::vector< std::string > & variableNames()
returns the names of the variables in the input dataset
const DBVector< std::string > & variableNames() const noexcept
returns the variable names for all the columns of the database
std::size_t nbVariables() const noexcept
returns the number of variables (columns) of the database
A class for storing a pair of sets of NodeIds, the second one corresponding to a conditional set.
the class for computing Chi2 independence test scores
std::pair< double, double > statistics(NodeId var1, NodeId var2, const std::vector< NodeId > &rhs_ids={}) override
get the pair <chi2 statistic,pvalue> for a test var1 indep var2 given rhs_ids
the class for computing G2 independence test scores
std::pair< double, double > statistics(NodeId var1, NodeId var2, const std::vector< NodeId > &rhs_ids={}) override
get the pair <G2statistic,pvalue> for a test var1 indep var2 given rhs_ids
the no a priorclass: corresponds to 0 weight-sample
The class for estimating parameters of CPTs using Maximum Likelihood.
The base class for estimating parameters of CPTs.
void setRanges(const std::vector< std::pair< std::size_t, std::size_t > > &new_ranges)
sets new ranges to perform the counts used by the parameter estimator
void setNumberOfThreads(Size nb) override
sets the number max of threads that can be used
The class for giving access to pseudo count : count in the database + prior.
std::vector< double > get(const std::vector< NodeId > &ids)
returns the pseudo-count of a pair of nodes given some other nodes
the class for computing AIC scores
std::string isPriorCompatible() const final
indicates whether the prior is compatible (meaningful) with the score
the class for computing Bayesian Dirichlet (BD) log2 scores
std::string isPriorCompatible() const final
indicates whether the prior is compatible (meaningful) with the score
the class for computing BDeu scores
std::string isPriorCompatible() const final
indicates whether the prior is compatible (meaningful) with the score
the class for computing BIC scores
std::string isPriorCompatible() const final
indicates whether the prior is compatible (meaningful) with the score
the class for computing K2 scores (actually their log2 value)
std::string isPriorCompatible() const final
indicates whether the prior is compatible (meaningful) with the score
the class for computing Log2-likelihood scores
std::string isPriorCompatible() const final
indicates whether the prior is compatible (meaningful) with the score
double score(const IdCondSet &idset)
returns the score for a given IdCondSet
The base class for all the scores used for learning (BIC, BDeu, etc).
the class for computing fNML scores
std::string isPriorCompatible() const final
indicates whether the prior is compatible (meaningful) with the score
The base class for structural constraints imposed by DAGs.
the structural constraint for forbidding the creation of some arcs during structure learning
the class for structural constraints limiting the number of parents of nodes in a directed graph
the structural constraint indicating that some arcs shall never be removed or reversed
the structural constraint for forbidding children for some nodes
the structural constraint for forbidding parents for some nodes
the structural constraint for forbidding the creation of some arcs except those defined in the class ...
the "meta-programming" class for storing structural constraints
the structural constraint imposing a partial order over nodes
The class imposing a N-sized tabu list as a structural constraints for learning algorithms.
the structural constraint imposing a total order over some nodes
#define GUM_ERROR(type, msg)
std::size_t Size
In aGrUM, hashed values are unsigned long int.
Set< Edge > EdgeSet
Some typdefs and define for shortcuts ...
Size NodeId
Type for node ids.
Set< Arc > ArcSet
Some typdefs and define for shortcuts ...
HashTable< NodeId, VAL > NodeProperty
Property on graph elements.
the class for computing Chi2 scores
the class for computing G2 scores
include the inlined functions if necessary
DatabaseTable readFile(const std::string &filename)
the base class for all the independence tests used for learning
the class for computing Log2-likelihood scores