aGrUM 3.0.0
a C++ library for (probabilistic) graphical models
FCI.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
55#ifndef GUM_LEARNING_FCI_H
56#define GUM_LEARNING_FCI_H
57
60
61namespace gum::learning {
62
79 class FCI: public CIBasedLearning {
80 public:
81 // ##########################################################################
83 // ##########################################################################
85
86 FCI();
87 FCI(const FCI&) = default;
88 FCI(FCI&&) noexcept;
89 ~FCI() override;
90
91 FCI& operator=(const FCI&);
92 FCI& operator=(FCI&&) noexcept;
93
95
96 // ##########################################################################
98 // ##########################################################################
100
102 void setMaxPathLength(Size maxLen);
103 Size maxPathLength() const;
104
106
107 // ##########################################################################
109 // ##########################################################################
111
114
117
119
122 std::vector< NodeId > possibleDSep(const PAG& pag, NodeId x, NodeId y) const;
123
125
126 protected:
129 void resolveOrientConflict_(NodeId src, NodeId dst) override;
130
131 private:
134 void orientCollidersOnPAG_(PAG& pag, const MixedGraph& topology);
135
137 std::vector< NodeId > computePossibleDSep_(const PAG& pag, NodeId x, NodeId y) const;
138
140 void possibleDSepPhase_(PAG& pag);
141
142 // Phase 5: orientation rules (all return true if any mark changed)
143 bool ruleR1_(PAG& pag) const;
144 bool ruleR2_(PAG& pag) const;
145 bool ruleR3_(PAG& pag) const;
146 bool ruleR5_(PAG& pag) const;
147 bool ruleR6_(PAG& pag) const;
148 bool ruleR7_(PAG& pag) const;
149 bool ruleR4_(PAG& pag) const;
150 bool ruleR8_(PAG& pag) const;
151 bool ruleR9_(PAG& pag) const;
152 bool ruleR10_(PAG& pag) const;
153
155 void applyOrientationRules_(PAG& pag) const;
156
158 bool doDdpOrientation_(PAG& pag,
159 NodeId d,
160 NodeId a,
161 NodeId b,
162 NodeId c,
163 const HashTable< NodeId, NodeId >& previous) const;
164
166 };
167
168} // namespace gum::learning
169
170#endif /* GUM_LEARNING_FCI_H */
Abstract base class for CI-test-based structure learning algorithms.
Partial Ancestral Graph (PAG) — graph type for FCI output.
The class for generic Hash Tables.
Definition hashTable.h:640
Base class for mixed graphs.
Definition mixedGraph.h:146
Partial Ancestral Graph: undirected topology with endpoint marks.
Definition PAG.h:90
PAG learnPAG(MixedGraph graph)
primary FCI output: learn a PAG from the given node-only or partial graph
Definition FCI.cpp:818
std::vector< NodeId > possibleDSep(const PAG &pag, NodeId x, NodeId y) const
learnSkeleton() inherited from CIBasedLearning
Definition FCI.cpp:86
bool doDdpOrientation_(PAG &pag, NodeId d, NodeId a, NodeId b, NodeId c, const HashTable< NodeId, NodeId > &previous) const
R4 helper: orient B,C in a detected discriminating path D..A,B,C.
Definition FCI.cpp:539
bool ruleR7_(PAG &pag) const
tail propagation from A-oB
Definition FCI.cpp:512
bool ruleR1_(PAG &pag) const
away from collider
Definition FCI.cpp:354
Size maxPathLength() const
maximum path length for R4 discriminating-path search; Size(-1) = unlimited
Definition FCI.cpp:84
bool ruleR3_(PAG &pag) const
double triangle
Definition FCI.cpp:405
FCI(const FCI &)=default
std::vector< NodeId > computePossibleDSep_(const PAG &pag, NodeId x, NodeId y) const
Phase 3: return all nodes on possible-d-sep paths from x toward y (excl. x, y).
Definition FCI.cpp:248
bool ruleR5_(PAG &pag) const
uncovered circle path → undirected
Definition FCI.cpp:449
void orientCollidersOnPAG_(PAG &pag, const MixedGraph &topology)
Phase 2 / Phase 4: orient unshielded colliders directly on the PAG. topology is used for unshielded-t...
Definition FCI.cpp:102
bool ruleR9_(PAG &pag) const
away from ancestor via uncovered pd-path
Definition FCI.cpp:719
bool ruleR6_(PAG &pag) const
tail propagation from undirected edge
Definition FCI.cpp:489
Size maxPathLength_
Definition FCI.h:165
void applyOrientationRules_(PAG &pag) const
Phase 5: fixed-point loop over all orientation rules R1–R10.
Definition FCI.cpp:797
bool ruleR8_(PAG &pag) const
away from ancestor (graph only)
Definition FCI.cpp:693
void resolveOrientConflict_(NodeId src, NodeId dst) override
conflict hook override: FCI leaves circle marks — orientation conflicts are not recorded as latent co...
Definition FCI.cpp:94
void possibleDSepPhase_(PAG &pag)
Phase 3: prune PAG edges using possibleDSep conditioning sets.
Definition FCI.cpp:287
bool ruleR2_(PAG &pag) const
away from cycle
Definition FCI.cpp:378
bool ruleR4_(PAG &pag) const
discriminating path (uses CI test)
Definition FCI.cpp:595
MixedGraph learnMixedStructure(MixedGraph graph) override
bridge for learnDAG/learnPDAG: runs learnPAG then converts via toMixedGraph()
Definition FCI.cpp:871
bool ruleR10_(PAG &pag) const
away from ancestor via two semi-directed paths
Definition FCI.cpp:744
void setMaxPathLength(Size maxLen)
maximum path length for R4 discriminating-path search; Size(-1) = unlimited
Definition FCI.cpp:82
std::size_t Size
In aGrUM, hashed values are unsigned long int.
Definition types.h:74
Size NodeId
Type for node ids.
include the inlined functions if necessary
Definition CSVParser.h:55
STL namespace.