56#ifndef GUM_LEARNING_SIMPLE_MIIC_H
57#define GUM_LEARNING_SIMPLE_MIIC_H
62#include <agrum/config.h>
152 template <
typename GUM_SCALAR =
double,
153 typename GRAPH_CHANGES_SELECTOR,
154 typename PARAM_ESTIMATOR >
155 BayesNet< GUM_SCALAR >
learnBN(GRAPH_CHANGES_SELECTOR& selector,
156 PARAM_ESTIMATOR& estimator,
186 HashTable< std::pair< NodeId, NodeId >, std::vector< NodeId > >& sepSet,
203 HashTable< std::pair< NodeId, NodeId >, std::vector< NodeId > >& sepSet,
217 const HashTable< std::pair< NodeId, NodeId >, std::vector< NodeId > >& sepSet);
223 const HashTable< std::pair< NodeId, NodeId >, std::vector< NodeId > >& sepSet);
236 const std::vector< NodeId >& ui,
250 const HashTable< std::pair< NodeId, NodeId >, std::vector< NodeId > >& sepSet);
262 const HashTable< std::pair< NodeId, NodeId >, std::vector< NodeId > >& sepSet,
263 HashTable< std::pair< NodeId, NodeId >,
char >& marks);
269 std::vector< ProbabilisticRanking >
271 std::vector< ProbabilisticRanking > probaTriples);
321 HashTable< std::pair< NodeId, NodeId >,
char >& marks,
329 HashTable< std::pair< NodeId, NodeId >,
char >& marks,
ApproximationScheme(bool verbosity=false)
The class for generic Hash Tables.
Base class for mixed graphs.
DAG learnStructure(CorrectedMutualInformation &I, MixedGraph graph)
learns the structure of a Bayesian network, i.e. a DAG, by first learning an Essential graph and then...
bool isOrientable_(const MixedGraph &graph, NodeId xi, NodeId xj) const
const std::vector< Arc > latentVariables() const
get the list of arcs hiding latent variables
const std::vector< NodeId > _emptySet_
an empty conditioning set
MixedGraph learnMixedStructure(CorrectedMutualInformation &mutualInformation, MixedGraph graph)
learns the structure of an Essential Graph
SimpleMiic & operator=(const SimpleMiic &from)
copy operator
void orientationMiic_(CorrectedMutualInformation &mutualInformation, MixedGraph &graph, const HashTable< std::pair< NodeId, NodeId >, std::vector< NodeId > > &sepSet)
Orientation phase from the MIIC algorithm, returns a mixed graph that may contain circles.
void _propagatingOrientationMiic_(MixedGraph &graph, HashTable< std::pair< NodeId, NodeId >, char > &marks, NodeId x, NodeId y, NodeId z, double p1, double p2)
void iteration_(CorrectedMutualInformation &mutualInformation, MixedGraph &graph, HashTable< std::pair< NodeId, NodeId >, std::vector< NodeId > > &sepSet, Heap< CondRanking, GreaterPairOn2nd > &rank)
Iteration phase.
bool _isNotLatentCouple_(NodeId x, NodeId y)
int _maxLog_
Fixes the maximum log that we accept in exponential computations.
void _orientingVstructureMiic_(MixedGraph &graph, HashTable< std::pair< NodeId, NodeId >, char > &marks, NodeId x, NodeId y, NodeId z, double p1, double p2)
~SimpleMiic() override
destructor
std::vector< ProbabilisticRanking > unshieldedTriplesMiic_(const MixedGraph &graph, CorrectedMutualInformation &mutualInformation, const HashTable< std::pair< NodeId, NodeId >, std::vector< NodeId > > &sepSet, 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 > _arcProbas_
Storing the propabilities for each arc set in the graph.
std::vector< Arc > _latentCouples_
an empty vector of arcs
static bool _existsDirectedPath_(const MixedGraph &graph, NodeId n1, NodeId n2)
checks for directed paths in a graph, consider double arcs like edges
HashTable< std::pair< NodeId, NodeId >, char > _initialMarks_
Initial marks for the orientation phase, used to convey constraints.
SimpleMiic()
default constructor
Size _size_
size of the database
void propagatesOrientationInChainOfRemainingEdges_(MixedGraph &graph)
heuristic for remaining edges when everything else has been tried
void orientationLatents_(CorrectedMutualInformation &mutualInformation, MixedGraph &graph, const HashTable< std::pair< NodeId, NodeId >, std::vector< NodeId > > &sepSet)
variant trying to propagate both orientations in a bidirected arc
MixedGraph learnPDAG(CorrectedMutualInformation &mutualInformation, MixedGraph graph)
learns the structure of an Essential Graph
bool propagatesRemainingOrientableEdges_(MixedGraph &graph, NodeId xj)
Propagates the orientation from a node to its neighbours.
void findBestContributor_(NodeId x, NodeId y, const std::vector< NodeId > &ui, const MixedGraph &graph, CorrectedMutualInformation &mutualInformation, Heap< CondRanking, GreaterPairOn2nd > &rank)
finds the best contributor node for a pair given a conditioning set
bool isForbidenArc_(NodeId x, NodeId y) const
void addConstraints(HashTable< std::pair< NodeId, NodeId >, char > constraints)
Set a ensemble of constraints for the orientation 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
static bool _existsNonTrivialDirectedPath_(const MixedGraph &graph, NodeId n1, NodeId n2)
checks for directed paths in a graph, considering double arcs like edges, not considering arc as a di...
std::vector< Ranking > unshieldedTriples_(const MixedGraph &graph, CorrectedMutualInformation &mutualInformation, const HashTable< std::pair< NodeId, NodeId >, std::vector< NodeId > > &sepSet)
gets the list of unshielded triples in the graph in decreasing value of |I'(x, y, z|{ui}...
std::vector< ProbabilisticRanking > updateProbaTriples_(const MixedGraph &graph, std::vector< ProbabilisticRanking > probaTriples)
Gets the orientation probabilities like MIIC for the orientation phase.
void initiation_(CorrectedMutualInformation &mutualInformation, MixedGraph &graph, HashTable< std::pair< NodeId, NodeId >, std::vector< NodeId > > &sepSet, Heap< CondRanking, GreaterPairOn2nd > &rank)
Initiation phase.
std::size_t Size
In aGrUM, hashed values are unsigned long int.
Size NodeId
Type for node ids.
HashTable< Arc, VAL > ArcProperty
Property on graph elements.
include the inlined functions if necessary
gum is the global namespace for all aGrUM entities