aGrUM 3.1.1
a C++ library for (probabilistic) graphical models
Miic.h
Go to the documentation of this file.
1/****************************************************************************
2 * This file is part of the aGrUM/pyAgrum library. *
3 * *
4 * Copyright (c) 2005-2026 by *
5 * - Pierre-Henri WUILLEMIN(_at_LIP6) *
6 * - Christophe GONZALES(_at_AMU) *
7 * *
8 * The aGrUM/pyAgrum library is free software; you can redistribute it *
9 * and/or modify it under the terms of either : *
10 * *
11 * - the GNU Lesser General Public License as published by *
12 * the Free Software Foundation, either version 3 of the License, *
13 * or (at your option) any later version, *
14 * - the MIT license (MIT), *
15 * - or both in dual license, as here. *
16 * *
17 * (see https://agrum.gitlab.io/articles/dual-licenses-lgplv3mit.html) *
18 * *
19 * This aGrUM/pyAgrum library is distributed in the hope that it will be *
20 * useful, but WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
21 * INCLUDING BUT NOT LIMITED TO THE WARRANTIES MERCHANTABILITY or FITNESS *
22 * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
23 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
24 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, *
25 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR *
26 * OTHER DEALINGS IN THE SOFTWARE. *
27 * *
28 * See LICENCES for more details. *
29 * *
30 * SPDX-FileCopyrightText: Copyright 2005-2026 *
31 * - Pierre-Henri WUILLEMIN(_at_LIP6) *
32 * - Christophe GONZALES(_at_AMU) *
33 * SPDX-License-Identifier: LGPL-3.0-or-later OR MIT *
34 * *
35 * Contact : info_at_agrum_dot_org *
36 * homepage : http://agrum.gitlab.io *
37 * gitlab : https://gitlab.com/agrumery/agrum *
38 * *
39 ****************************************************************************/
40
41
59#ifndef GUM_LEARNING_MIIC_H
60#define GUM_LEARNING_MIIC_H
61
65
66namespace gum {
67
68 namespace learning {
69
70 using CondThreePoints = std::tuple< NodeId, NodeId, NodeId, std::vector< NodeId > >;
71 using CondRanking = std::pair< CondThreePoints*, double >;
72 using Ranking = std::pair< ThreePoints*, double >;
73 using ProbabilisticRanking = std::tuple< ThreePoints*, double, double, double >;
74
76 public:
77 bool operator()(const CondRanking& e1, const CondRanking& e2) const;
78 };
79
81 public:
82 bool operator()(const Ranking& e1, const Ranking& e2) const;
83 };
84
86 public:
87 bool operator()(const ProbabilisticRanking& e1, const ProbabilisticRanking& e2) const;
88 };
89
101 public:
102 // ##########################################################################
104 // ##########################################################################
106
107 Miic();
108 explicit Miic(int maxLog);
109 Miic(const Miic& from);
110 Miic(Miic&& from);
111 ~Miic() override;
112
114
115 Miic& operator=(const Miic& from);
116 Miic& operator=(Miic&& from);
117
118 // ##########################################################################
120 // ##########################################################################
122
124
126
127 // ##########################################################################
129 // ##########################################################################
131
133
135
137
138 protected:
139 // ##########################################################################
141 // ##########################################################################
143
144 void initiation_(CorrectedMutualInformation& mutualInformation,
146 HashTable< std::pair< NodeId, NodeId >, std::vector< NodeId > >& sepSet,
148
149 void iteration_(CorrectedMutualInformation& mutualInformation,
151 HashTable< std::pair< NodeId, NodeId >, std::vector< NodeId > >& sepSet,
153
155
156 // ##########################################################################
158 // ##########################################################################
160
161 void orientationMiic_(
162 CorrectedMutualInformation& mutualInformation,
164 const HashTable< std::pair< NodeId, NodeId >, std::vector< NodeId > >& sepSet);
165
167 NodeId y,
168 const std::vector< NodeId >& ui,
169 const MixedGraph& graph,
170 CorrectedMutualInformation& mutualInformation,
172
173 std::vector< ProbabilisticRanking > unshieldedTriplesMiic_(
174 const MixedGraph& graph,
175 CorrectedMutualInformation& mutualInformation,
176 const HashTable< std::pair< NodeId, NodeId >, std::vector< NodeId > >& sepSet,
177 HashTable< std::pair< NodeId, NodeId >, char >& marks);
178
179 std::vector< ProbabilisticRanking >
181 std::vector< ProbabilisticRanking > probaTriples);
182
184
185 private:
188
190 HashTable< std::pair< NodeId, NodeId >, char >& marks,
191 NodeId x,
192 NodeId y,
193 NodeId z,
194 double p1,
195 double p2);
196
198 HashTable< std::pair< NodeId, NodeId >, char >& marks,
199 NodeId x,
200 NodeId y,
201 NodeId z,
202 double p1,
203 double p2);
204
206 };
207
208 } /* namespace learning */
209
210} /* namespace gum */
211
212#endif /* GUM_LEARNING_MIIC_H */
Abstract base class for constraint-based structure learning algorithms.
The class for generic Hash Tables.
Definition hashTable.h:640
Heap data structure.
Definition heap.h:141
Base class for mixed graphs.
Definition mixedGraph.h:146
The class computing n times the corrected mutual information, as used in the MIIC algorithm.
bool operator()(const Ranking &e1, const Ranking &e2) const
Definition Miic.cpp:99
bool operator()(const CondRanking &e1, const CondRanking &e2) const
Definition Miic.cpp:95
bool operator()(const ProbabilisticRanking &e1, const ProbabilisticRanking &e2) const
Definition Miic.cpp:103
std::vector< ProbabilisticRanking > updateProbaTriples_(const MixedGraph &graph, std::vector< ProbabilisticRanking > probaTriples)
Definition Miic.cpp:633
void _orientingVstructureMiic_(MixedGraph &graph, HashTable< std::pair< NodeId, NodeId >, char > &marks, NodeId x, NodeId y, NodeId z, double p1, double p2)
Definition Miic.cpp:331
void orientationMiic_(CorrectedMutualInformation &mutualInformation, MixedGraph &graph, const HashTable< std::pair< NodeId, NodeId >, std::vector< NodeId > > &sepSet)
Definition Miic.cpp:257
Miic & operator=(const Miic &from)
Definition Miic.cpp:75
MixedGraph learnMixedStructure(MixedGraph graph) override
Definition Miic.cpp:143
MixedGraph learnSkeleton(MixedGraph graph) override
Definition Miic.cpp:126
~Miic() override
Definition Miic.cpp:73
void _propagatingOrientationMiic_(MixedGraph &graph, HashTable< std::pair< NodeId, NodeId >, char > &marks, NodeId x, NodeId y, NodeId z, double p1, double p2)
Definition Miic.cpp:441
void iteration_(CorrectedMutualInformation &mutualInformation, MixedGraph &graph, HashTable< std::pair< NodeId, NodeId >, std::vector< NodeId > > &sepSet, Heap< CondRanking, GreaterPairOn2nd > &rank)
Definition Miic.cpp:206
void findBestContributor_(NodeId x, NodeId y, const std::vector< NodeId > &ui, const MixedGraph &graph, CorrectedMutualInformation &mutualInformation, Heap< CondRanking, GreaterPairOn2nd > &rank)
Definition Miic.cpp:533
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)
Definition Miic.cpp:594
CorrectedMutualInformation * mi_
Definition Miic.h:186
ArcProperty< double > _arcProbas_
Definition Miic.h:187
void initiation_(CorrectedMutualInformation &mutualInformation, MixedGraph &graph, HashTable< std::pair< NodeId, NodeId >, std::vector< NodeId > > &sepSet, Heap< CondRanking, GreaterPairOn2nd > &rank)
Definition Miic.cpp:166
void setMutualInformation(CorrectedMutualInformation &mi)
Definition Miic.cpp:89
bool _isNotLatentCouple_(NodeId x, NodeId y)
Definition Miic.cpp:674
The class computing n times the corrected mutual information (where n is the size (or the weight) of ...
Size NodeId
Type for node ids.
HashTable< Arc, VAL > ArcProperty
Property on graph elements.
Heaps definition.
include the inlined functions if necessary
Definition CSVParser.h:55
std::pair< ThreePoints *, double > Ranking
Definition Miic.h:72
std::pair< CondThreePoints *, double > CondRanking
Definition Miic.h:71
std::tuple< NodeId, NodeId, NodeId, std::vector< NodeId > > CondThreePoints
Definition Miic.h:70
std::tuple< ThreePoints *, double, double, double > ProbabilisticRanking
Definition Miic.h:73
gum is the global namespace for all aGrUM entities
Definition agrum.h:46