aGrUM 3.0.0
a C++ library for (probabilistic) graphical models
CIBasedLearning.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_CI_BASED_LEARNING_H
56#define GUM_CI_BASED_LEARNING_H
57
58#include <vector>
59
62
63namespace gum {
64
65 namespace learning {
66
82 public:
84 enum class UCPriority : uint8_t {
87 };
88
89 // ##########################################################################
91 // ##########################################################################
93
97 ~CIBasedLearning() override;
98
99 CIBasedLearning& operator=(const CIBasedLearning&);
100 CIBasedLearning& operator=(CIBasedLearning&&) noexcept;
101
103
104 // ##########################################################################
106 // ##########################################################################
108
111
113
114 // ##########################################################################
116 // ##########################################################################
118
119 void setAlpha(double alpha);
120 double alpha() const;
121
123 void setMaxCondSetSize(Size max_k);
124
126 void setStable(bool stable);
127
130 void setExhaustiveSepSet(bool exhaustive);
131 bool exhaustiveSepSet() const;
132
135 UCPriority ucPriority() const;
136
138
139 // ##########################################################################
141 // ##########################################################################
143
146
147 // learnMixedStructure() remains pure virtual (inherited from ConstraintBasedLearning)
148
150
151 protected:
152 // separation set entry: conditioning set + p-value that triggered removal
154 std::vector< NodeId > cond;
155 double pval{0.0};
156 };
157
158 // ##########################################################################
160 // ##########################################################################
162
165
168
172 virtual void resolveOrientConflict_(NodeId src, NodeId dst);
173
175
176 // ##########################################################################
178 // ##########################################################################
179
181 double alpha_ = 0.05;
183 bool stable_ = true;
184 bool exhaustiveSepSet_ = false;
186
188 };
189
190 } /* namespace learning */
191
192} /* namespace gum */
193
194#endif /* GUM_CI_BASED_LEARNING_H */
Abstract base class for constraint-based structure learning algorithms.
The class for generic Hash Tables.
Definition hashTable.h:640
Base class for mixed graphs.
Definition mixedGraph.h:146
MixedGraph orientUnshieldedColliders_(MixedGraph graph)
orient unshielded colliders in graph and return the updated graph
CIBasedLearning(const CIBasedLearning &)
void setAlpha(double alpha)
maximum conditioning set size; Size(-1) = unlimited (default)
UCPriority ucPriority() const
maximum conditioning set size; Size(-1) = unlimited (default)
void orientColliderArm_(MixedGraph &graph, NodeId src, NodeId dst)
orient one arm (src → dst) of a collider; calls resolveOrientConflict_ on conflict
bool exhaustiveSepSet() const
maximum conditioning set size; Size(-1) = unlimited (default)
void setIndependenceTest(IndependenceTest &test)
inject independence test (non-owning: caller manages lifetime)
void setUCPriority(UCPriority p)
collider candidate ordering (default: Standard)
UCPriority
Controls how collider candidates are ordered before orientation.
@ Sorted
descending p-value order (strongest evidence first)
@ Standard
process triples in natural traversal order
void setMaxCondSetSize(Size max_k)
maximum conditioning set size; Size(-1) = unlimited (default)
MixedGraph learnSkeleton(MixedGraph graph) override
Phase 1: skeleton discovery via conditional independence tests.
double alpha() const
maximum conditioning set size; Size(-1) = unlimited (default)
void setStable(bool stable)
stable mode: defer edge removals until end of each depth (default: true)
virtual void resolveOrientConflict_(NodeId src, NodeId dst)
conflict hook: called when orientation cannot proceed (arc blocked or reversed). Default: push Arc(sr...
HashTable< std::pair< NodeId, NodeId >, SepSetEntry_ > sepSet_
void setExhaustiveSepSet(bool exhaustive)
exhaustive sepset mode: accumulate union of all separating sets found at each depth,...
The base class for all the independence tests used for learning.
std::size_t Size
In aGrUM, hashed values are unsigned long int.
Definition types.h:74
Size NodeId
Type for node ids.
the base class for all the independence tests used for learning
include the inlined functions if necessary
Definition CSVParser.h:55
gum is the global namespace for all aGrUM entities
Definition agrum.h:46