![]() |
aGrUM
0.20.3
a C++ library for (probabilistic) graphical models
|
Copyright (c) 2005-2021 by Pierre-Henri WUILLEMIN() & Christophe GONZALES() info_at_agrum_dot_org. More...
#include <agrum/agrum.h>
#include <agrum/tools/core/OMPThreads.h>
#include <agrum/tools/core/sequence.h>
#include <agrum/tools/core/set.h>
#include <agrum/tools/graphs/diGraph.h>
#include <agrum/BN/learning/structureUtils/IGraphChangesGenerator4DiGraph.h>
#include <agrum/BN/learning/structureUtils/graphChange.h>
#include <agrum/BN/learning/structureUtils/graphChangesGenerator4K2_tpl.h>
Go to the source code of this file.
Classes | |
struct | gum::learning::_GraphChangesGenerator4K2_ |
class | gum::learning::GraphChangesGenerator4K2< STRUCT_CONSTRAINT > |
The basic class for computing the next graph changes possible in a structure learning algorithm. More... | |
Namespaces | |
gum | |
Copyright (c) 2005-2021 by Pierre-Henri WUILLEMIN() & Christophe GONZALES() info_at_agrum_dot_org. | |
gum::learning | |
Copyright (c) 2005-2021 by Pierre-Henri WUILLEMIN() & Christophe GONZALES() info_at_agrum_dot_org.
This library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with this library. If not, see http://www.gnu.org/licenses/. The basic class for computing the set of digraph changes allowed by the user to be executed by the learning algorithms
Structure learning algorithm try different modifications of the graph. Class GraphChangesGenerator4DiGraph provides a simple way to compute those that we wish to perform. For instance, in the basic LocalSearch algorithm for learning directed graphs, one may expect that all possible arc additions, deletions and reversals can be applied and GraphChangesGenerator4DiGraph provides exactly this set of operations. However, there may be cases where we would like to apply these operators, say, only on a subgraph. In this case, we should use the derived class of GraphChangesGenerator4DiGraph named GraphChangesGeneratorOnSubDiGraph. Anyway, all the search generators should have the following minimal methods:
Basically, the idea is to use method setGraph at the beginning of the structure learning in order to initialize the possible set of changes. Then, parse this set using a for ( auto iter = generator.begin (); iter != generator.end (); ++iter ) loop and compute the scores induced by these changes. When this is done, flush the generator by calling method clearChanges. Then iterate changes and after each new change applied, used again the iterator for loop, and so on. Note that, whenever you execute method modifyGraph, this will automatically flush the current list of changes and put into the list only the changes that are affected by the graph modification.
Definition in file graphChangesGenerator4K2.h.