aGrUM
3.2.0
a C++ library for (probabilistic) graphical models
Toggle main menu visibility
MCBNDistance.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
50
51
52
#ifndef GUM_MC_KL_H
53
#define GUM_MC_KL_H
54
55
#include <
agrum/base/core/approximations/approximationScheme.h
>
56
#include <
agrum/BN/algorithms/divergence/BNdistance.h
>
57
58
namespace
gum
{
59
95
96
template
< GUM_Numeric GUM_SCALAR >
97
class
MCBNDistance
:
public
BNdistance
< GUM_SCALAR >,
public
ApproximationScheme
{
98
public
:
99
/* no default constructor */
100
106
MCBNDistance
(
const
IBayesNet< GUM_SCALAR >
& P,
const
IBayesNet< GUM_SCALAR >
& Q);
107
110
explicit
MCBNDistance
(
const
BNdistance< GUM_SCALAR >
& kl);
111
113
~MCBNDistance
()
override
;
114
115
protected
:
116
void
computeKL_
()
final
;
117
120
Instantiation
drawSample_
(
const
Sequence< NodeId >
& topoOrder)
const
;
121
122
using
BNdistance
< GUM_SCALAR >
::p_
;
123
using
BNdistance
< GUM_SCALAR >
::q_
;
124
using
BNdistance
< GUM_SCALAR >
::hellinger_
;
125
using
BNdistance
< GUM_SCALAR >
::bhattacharya_
;
126
using
BNdistance
< GUM_SCALAR >
::jsd_
;
127
128
using
BNdistance
< GUM_SCALAR >
::klPQ_
;
129
using
BNdistance
< GUM_SCALAR >
::klQP_
;
130
131
using
BNdistance
< GUM_SCALAR >
::errorPQ_
;
132
using
BNdistance
< GUM_SCALAR >
::errorQP_
;
133
};
134
135
136
#ifndef GUM_NO_EXTERN_TEMPLATE_CLASS
137
extern
template
class
GUM_PUBLIC_BN
MCBNDistance< double >
;
138
#endif
139
140
}
// namespace gum
141
142
#include <
agrum/BN/algorithms/divergence/MCBNDistance_tpl.h
>
143
144
#endif
BNdistance.h
algorithm for KL divergence between BNs
MCBNDistance_tpl.h
KL divergence between BNs – implementation using independent Monte Carlo sampling.
approximationScheme.h
This file contains general scheme for iteratively convergent algorithms.
gum::ApproximationScheme::ApproximationScheme
ApproximationScheme(bool verbosity=false)
Definition
approximationScheme.cpp:58
gum::BNdistance::hellinger_
GUM_SCALAR hellinger_
Definition
BNdistance.h:165
gum::BNdistance::klPQ_
GUM_SCALAR klPQ_
Definition
BNdistance.h:159
gum::BNdistance::BNdistance
BNdistance(const IBayesNet< GUM_SCALAR > &P, const IBayesNet< GUM_SCALAR > &Q)
constructor must give 2 BNs
Definition
BNdistance_tpl.h:60
gum::BNdistance::jsd_
GUM_SCALAR jsd_
Definition
BNdistance.h:167
gum::BNdistance::klQP_
GUM_SCALAR klQP_
Definition
BNdistance.h:160
gum::BNdistance::errorPQ_
Size errorPQ_
Definition
BNdistance.h:162
gum::BNdistance::errorQP_
Size errorQP_
Definition
BNdistance.h:163
gum::BNdistance::bhattacharya_
GUM_SCALAR bhattacharya_
Definition
BNdistance.h:166
gum::BNdistance::q_
const IBayesNet< GUM_SCALAR > & q_
Definition
BNdistance.h:157
gum::BNdistance::p_
const IBayesNet< GUM_SCALAR > & p_
Definition
BNdistance.h:156
gum::IBayesNet
Class representing the minimal interface for Bayesian network with no numerical data.
Definition
IBayesNet.h:75
gum::Instantiation
Class for assigning/browsing values to tuples of discrete variables.
Definition
instantiation.h:102
gum::MCBNDistance::computeKL_
void computeKL_() final
Definition
MCBNDistance_tpl.h:114
gum::MCBNDistance::drawSample_
Instantiation drawSample_(const Sequence< NodeId > &topoOrder) const
draws an instantiation of p_'s variables, independently, following topoOrder (no evidence to handle i...
Definition
MCBNDistance_tpl.h:101
gum::MCBNDistance::MCBNDistance
MCBNDistance(const IBayesNet< GUM_SCALAR > &P, const IBayesNet< GUM_SCALAR > &Q)
constructor must give 2 BNs
Definition
MCBNDistance_tpl.h:69
gum::Sequence< NodeId >
gum
gum is the global namespace for all aGrUM entities
Definition
agrum.h:46
gum::MCBNDistance< double >
template class GUM_PUBLIC_BN MCBNDistance< double >
Definition
MCBNDistance.cpp:48
aGrUM
3.2.0
© PHW&CG&others - 2022
DoXyGeN 1.18.0