aGrUM
3.2.0
a C++ library for (probabilistic) graphical models
Toggle main menu visibility
informationTheory.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
49
50
#ifndef GUM_INFORMATION_THEORY_H
51
#define GUM_INFORMATION_THEORY_H
52
#include <concepts>
53
#include <functional>
54
55
#include <
agrum/agrum.h
>
56
57
#include <
agrum/base/multidim/tensor.h
>
58
59
namespace
gum
{
60
template
<
typename
T >
61
concept
JointTargettable
=
requires
(T t,
const
NodeSet
& target) {
62
{ t.addJointTarget(target) } -> std::same_as< void >;
63
};
64
80
template
<
template
<
typename
>
class
INFERENCE_ENGINE,
typename
GUM_SCALAR >
81
//@todo when CLANG-compliant for virtual class: requires JointTargettable< INFERENCE_ENGINE<
82
// GUM_SCALAR > >
83
class
InformationTheory
{
84
public
:
85
InformationTheory
(INFERENCE_ENGINE< GUM_SCALAR >& engine,
86
NodeSet
X,
// X,Y,Z passed by Value & move
87
NodeSet
Y,
88
NodeSet
Z);
89
InformationTheory
(INFERENCE_ENGINE< GUM_SCALAR >& engine,
const
NodeSet
& X,
const
NodeSet
& Y);
90
InformationTheory
(INFERENCE_ENGINE< GUM_SCALAR >& engine,
91
const
std::vector< std::string >& Xnames,
92
const
std::vector< std::string >& Ynames);
93
InformationTheory
(INFERENCE_ENGINE< GUM_SCALAR >& engine,
94
const
std::vector< std::string >& Xnames,
95
const
std::vector< std::string >& Ynames,
96
const
std::vector< std::string >& Znames);
97
~InformationTheory
();
98
99
GUM_SCALAR
entropyXY
();
100
GUM_SCALAR
entropyX
();
101
GUM_SCALAR
entropyY
();
102
103
GUM_SCALAR
entropyXgivenY
();
104
GUM_SCALAR
entropyYgivenX
();
105
GUM_SCALAR
mutualInformationXY
();
106
GUM_SCALAR
variationOfInformationXY
();
107
108
109
GUM_SCALAR
entropyXgivenZ
();
110
GUM_SCALAR
entropyYgivenZ
();
111
GUM_SCALAR
entropyXYgivenZ
();
112
GUM_SCALAR
entropyXgivenYZ
();
113
GUM_SCALAR
mutualInformationXYgivenZ
();
114
115
protected
:
116
INFERENCE_ENGINE< GUM_SCALAR >&
engine_
;
117
118
const
NodeSet
X_
;
119
const
NodeSet
Y_
;
120
const
NodeSet
Z_
;
121
122
VariableSet
vX_
;
123
VariableSet
vY_
;
124
VariableSet
vZ_
;
125
126
Tensor< GUM_SCALAR >
pXYZ_
;
127
Tensor< GUM_SCALAR >
pXY_
;
128
Tensor< GUM_SCALAR >
pXZ_
;
129
Tensor< GUM_SCALAR >
pYZ_
;
130
Tensor< GUM_SCALAR >
pX_
;
131
Tensor< GUM_SCALAR >
pY_
;
132
Tensor< GUM_SCALAR >
pZ_
;
133
134
void
makeInference_
();
135
};
136
}
// namespace gum
137
138
#include <
agrum/base/graphicalModels/algorithms/informationTheory_tpl.h
>
139
#endif
// GUM_INFORMATION_THEORY_H
agrum.h
gum::InformationTheory::pY_
Tensor< GUM_SCALAR > pY_
Definition
informationTheory.h:131
gum::InformationTheory::pXYZ_
Tensor< GUM_SCALAR > pXYZ_
Definition
informationTheory.h:126
gum::InformationTheory::makeInference_
void makeInference_()
Definition
informationTheory_tpl.h:107
gum::InformationTheory::entropyYgivenZ
GUM_SCALAR entropyYgivenZ()
Definition
informationTheory_tpl.h:205
gum::InformationTheory::entropyY
GUM_SCALAR entropyY()
Definition
informationTheory_tpl.h:154
gum::InformationTheory::entropyXYgivenZ
GUM_SCALAR entropyXYgivenZ()
Definition
informationTheory_tpl.h:242
gum::InformationTheory::entropyXY
GUM_SCALAR entropyXY()
Definition
informationTheory_tpl.h:157
gum::InformationTheory::Z_
const NodeSet Z_
Definition
informationTheory.h:120
gum::InformationTheory::pX_
Tensor< GUM_SCALAR > pX_
Definition
informationTheory.h:130
gum::InformationTheory::entropyXgivenYZ
GUM_SCALAR entropyXgivenYZ()
Definition
informationTheory_tpl.h:257
gum::InformationTheory::vX_
VariableSet vX_
Definition
informationTheory.h:122
gum::InformationTheory::InformationTheory
InformationTheory(INFERENCE_ENGINE< GUM_SCALAR > &engine, NodeSet X, NodeSet Y, NodeSet Z)
Definition
informationTheory_tpl.h:63
gum::InformationTheory::entropyYgivenX
GUM_SCALAR entropyYgivenX()
Definition
informationTheory_tpl.h:176
gum::InformationTheory::mutualInformationXYgivenZ
GUM_SCALAR mutualInformationXYgivenZ()
Definition
informationTheory_tpl.h:272
gum::InformationTheory::pXZ_
Tensor< GUM_SCALAR > pXZ_
Definition
informationTheory.h:128
gum::InformationTheory::vY_
VariableSet vY_
Definition
informationTheory.h:123
gum::InformationTheory::vZ_
VariableSet vZ_
Definition
informationTheory.h:124
gum::InformationTheory::mutualInformationXY
GUM_SCALAR mutualInformationXY()
Definition
informationTheory_tpl.h:220
gum::InformationTheory::pYZ_
Tensor< GUM_SCALAR > pYZ_
Definition
informationTheory.h:129
gum::InformationTheory::entropyXgivenY
GUM_SCALAR entropyXgivenY()
Definition
informationTheory_tpl.h:162
gum::InformationTheory::variationOfInformationXY
GUM_SCALAR variationOfInformationXY()
Definition
informationTheory_tpl.h:234
gum::InformationTheory::X_
const NodeSet X_
Definition
informationTheory.h:118
gum::InformationTheory::pZ_
Tensor< GUM_SCALAR > pZ_
Definition
informationTheory.h:132
gum::InformationTheory::entropyXgivenZ
GUM_SCALAR entropyXgivenZ()
Definition
informationTheory_tpl.h:190
gum::InformationTheory::engine_
INFERENCE_ENGINE< GUM_SCALAR > & engine_
Definition
informationTheory.h:116
gum::InformationTheory::pXY_
Tensor< GUM_SCALAR > pXY_
Definition
informationTheory.h:127
gum::InformationTheory::Y_
const NodeSet Y_
Definition
informationTheory.h:119
gum::InformationTheory::entropyX
GUM_SCALAR entropyX()
Definition
informationTheory_tpl.h:151
gum::JointTargettable
Definition
informationTheory.h:61
gum::NodeSet
Set< NodeId > NodeSet
Some typdefs and define for shortcuts ...
Definition
graphElements.h:392
informationTheory_tpl.h
Implementation of the Class encapsulating computations of notions from Information Theory.
gum
gum is the global namespace for all aGrUM entities
Definition
agrum.h:46
gum::VariableSet
Set< const DiscreteVariable * > VariableSet
Definition
discreteVariable.h:192
tensor.h
Header of the Tensor class.
aGrUM
3.2.0
© PHW&CG&others - 2022
DoXyGeN 1.18.0