39 #ifndef GUM_LEARNING_3_OFF_2_H 40 #define GUM_LEARNING_3_OFF_2_H 45 #include <agrum/BN/BayesNet.h> 46 #include <agrum/config.h> 47 #include <agrum/tools/core/approximations/IApproximationSchemeConfiguration.h> 48 #include <agrum/tools/core/approximations/approximationScheme.h> 49 #include <agrum/tools/core/heap.h> 50 #include <agrum/tools/graphs/DAG.h> 51 #include <agrum/tools/graphs/mixedGraph.h> 52 #include <agrum/tools/stattests/correctedMutualInformation.h> 72 const std::pair< std::tuple< NodeId, NodeId, NodeId >*,
double >& e1,
73 const std::pair< std::tuple< NodeId, NodeId, NodeId >*,
double >& e2)
81 tuple< std::tuple< NodeId, NodeId, NodeId >*,
double,
double,
double >&
84 tuple< std::tuple< NodeId, NodeId, NodeId >*,
double,
double,
double >&
168 template <
typename GUM_SCALAR =
double,
169 typename GRAPH_CHANGES_SELECTOR,
170 typename PARAM_ESTIMATOR >
185 HashTable< std::pair< NodeId, NodeId >,
char > constraints);
206 CorrectedMutualInformation<>& I,
227 CorrectedMutualInformation<>& I,
286 const std::vector< NodeId >& ui,
287 const MixedGraph& graph,
288 CorrectedMutualInformation<>& I,
375 const bool countArc =
true)
const;
void propagatesHead_(MixedGraph &graph, NodeId node)
Propagates the orientation from a node to its neighbours.
void set3off2Behaviour()
Sets the orientation phase to follow the one of the 3off2 algorithm.
void findBestContributor_(NodeId x, NodeId y, const std::vector< NodeId > &ui, const MixedGraph &graph, CorrectedMutualInformation<> &I, Heap< std::pair< std::tuple< NodeId, NodeId, NodeId, std::vector< NodeId > > *, double >, GreaterPairOn2nd > &rank_)
finds the best contributor node for a pair given a conditioning set
MixedGraph learnMixedStructure(CorrectedMutualInformation<> &I, MixedGraph graph)
learns the structure of an Essential Graph
INLINE void emplace(Args &&... args)
void orientation_miic_(CorrectedMutualInformation<> &I, MixedGraph &graph, const HashTable< std::pair< NodeId, NodeId >, std::vector< NodeId > > &sep_set)
Orientation phase from the MIIC algorithm, returns a mixed graph that may contain circles...
Miic & operator=(const Miic &from)
copy operator
void addConstraints(HashTable< std::pair< NodeId, NodeId >, char > constraints)
Set a ensemble of constraints for the orientation phase.
std::vector< std::tuple< std::tuple< NodeId, NodeId, NodeId > *, double, double, double > > getUnshieldedTriplesMIIC_(const MixedGraph &graph, CorrectedMutualInformation<> &I, const HashTable< std::pair< NodeId, NodeId >, std::vector< NodeId > > &sep_set, HashTable< std::pair< NodeId, NodeId >, char > &marks)
gets the list of unshielded triples in the graph in decreasing value of |I'(x, y, z|{ui})|...
ArcProperty< double > arc_probas__
Storing the propabilities for each arc set in the graph.
std::vector< std::tuple< std::tuple< NodeId, NodeId, NodeId > *, double, double, double > > updateProbaTriples_(const MixedGraph &graph, std::vector< std::tuple< std::tuple< NodeId, NodeId, NodeId > *, double, double, double > > proba_triples)
Gets the orientation probabilities like MIIC for the orientation phase.
Miic(int maxLog)
default constructor with maxLog
int maxLog__
Fixes the maximum log that we accept in exponential computations.
const std::vector< Arc > latentVariables() const
get the list of arcs hiding latent variables
Miic & operator=(Miic &&from)
move operator
void orientation_3off2_(CorrectedMutualInformation<> &I, MixedGraph &graph, const HashTable< std::pair< NodeId, NodeId >, std::vector< NodeId > > &sep_set)
Orientation phase from the 3off2 algorithm, returns a CPDAG.
void setMiicBehaviour()
Sets the orientation phase to follow the one of the MIIC algorithm.
std::vector< std::pair< std::tuple< NodeId, NodeId, NodeId > *, double > > getUnshieldedTriples_(const MixedGraph &graph, CorrectedMutualInformation<> &I, const HashTable< std::pair< NodeId, NodeId >, std::vector< NodeId > > &sep_set)
gets the list of unshielded triples in the graph in decreasing value of |I'(x, y, z|{ui})| ...
const bool existsDirectedPath__(const MixedGraph &graph, const NodeId n1, const NodeId n2, const bool countArc=true) const
checks for directed paths in a graph, consider double arcs like edges
bool operator()(const std::pair< std::tuple< NodeId, NodeId, NodeId > *, double > &e1, const std::pair< std::tuple< NodeId, NodeId, NodeId > *, double > &e2) const
HashTable< std::pair< NodeId, NodeId >, char > initial_marks__
Initial marks for the orientation phase, used to convey constraints.
void initiation_(CorrectedMutualInformation<> &I, MixedGraph &graph, HashTable< std::pair< NodeId, NodeId >, std::vector< NodeId > > &sep_set, Heap< std::pair< std::tuple< NodeId, NodeId, NodeId, std::vector< NodeId > > *, double >, GreaterPairOn2nd > &rank_)
Initiation phase.
bool usemiic__
wether to use the miic algorithm or not
Miic()
default constructor
std::vector< Arc > latent_couples__
an empty vector of arcs
Miic(const Miic &from)
copy constructor
bool operator()(const std::tuple< std::tuple< NodeId, NodeId, NodeId > *, double, double, double > &e1, const std::tuple< std::tuple< NodeId, NodeId, NodeId > *, double, double, double > &e2) const
const std::vector< NodeId > empty_set__
an empty conditioning set
Size N__
size of the database
The miic learning algorithm.
void orientation_latents_(CorrectedMutualInformation<> &I, MixedGraph &graph, const HashTable< std::pair< NodeId, NodeId >, std::vector< NodeId > > &sep_set)
Modified version of the orientation phase that tries to propagate orientations from both orientations...
bool operator()(const std::pair< std::tuple< NodeId, NodeId, NodeId, std::vector< NodeId > > *, double > &e1, const std::pair< std::tuple< NodeId, NodeId, NodeId, std::vector< NodeId > > *, double > &e2) const
Miic(Miic &&from)
move constructor
Database(const std::string &filename, const BayesNet< GUM_SCALAR > &bn, const std::vector< std::string > &missing_symbols)
void iteration_(CorrectedMutualInformation<> &I, MixedGraph &graph, HashTable< std::pair< NodeId, NodeId >, std::vector< NodeId > > &sep_set, Heap< std::pair< std::tuple< NodeId, NodeId, NodeId, std::vector< NodeId > > *, double >, GreaterPairOn2nd > &rank_)
Iteration phase.
BayesNet< GUM_SCALAR > learnBN(GRAPH_CHANGES_SELECTOR &selector, PARAM_ESTIMATOR &estimator, DAG initial_dag=DAG())
learns the structure and the parameters of a BN
DAG learnStructure(CorrectedMutualInformation<> &I, MixedGraph graph)
learns the structure of an Bayesian network, ie a DAG, by first learning an Essential graph and then ...