![]() |
aGrUM
0.21.0
a C++ library for (probabilistic) graphical models
|
ExactBNdistance computes exactly the KL divergence betweens 2 BNs. More...
#include <exactBNdistance.h>
Public Member Functions | |
ExactBNdistance (const IBayesNet< GUM_SCALAR > &P, const IBayesNet< GUM_SCALAR > &Q) | |
constructor must give 2 BNs More... | |
ExactBNdistance (const BNdistance< GUM_SCALAR > &kl) | |
copy constructor More... | |
virtual | ~ExactBNdistance () |
destructor More... | |
Complexity | difficulty () const |
return KL::Complexity::Heavy,KL::Complexity::Difficult,KL::Complexity::Correct depending on the BNs p and q More... | |
Accessors to results. The first call do the computations. The | |
others do not. | |
double | klPQ () |
Size | errorPQ () |
double | klQP () |
Size | errorQP () |
double | hellinger () |
double | bhattacharya () |
double | jsd () |
const IBayesNet< GUM_SCALAR > & | p () const |
const IBayesNet< GUM_SCALAR > & | q () const |
Protected Attributes | |
const IBayesNet< GUM_SCALAR > & | p_ |
const IBayesNet< GUM_SCALAR > & | q_ |
GUM_SCALAR | klPQ_ |
GUM_SCALAR | klQP_ |
Size | errorPQ_ |
Size | errorQP_ |
GUM_SCALAR | hellinger_ |
GUM_SCALAR | bhattacharya_ |
GUM_SCALAR | jsd_ |
Protected Member Functions | |
void | computeKL_ () final |
void | process_ () |
ExactBNdistance computes exactly the KL divergence betweens 2 BNs.
ExactBNdistance should be used only if difficulty() gives an estimation ( KL_CORRECT ) of the needed time. KL.process() computes KL(P||Q) using klPQ() and KL(Q||P) using klQP(). The computations are made once. The second is for free :) ExactBNdistance allows as well to compute in the same time the Hellinger distance ( \( *\sqrt{\sum_i (\sqrt{p_i}-\sqrt{q_i})^2}\)) (Kokolakis and Nanopoulos, 2001).
It may happen that P*ln(P/Q) is not computable (Q=0 and P!=0). In such a case, KL keeps working but trace this error (errorPQ() and errorQP())? *
Definition at line 69 of file exactBNdistance.h.
gum::ExactBNdistance< GUM_SCALAR >::ExactBNdistance | ( | const IBayesNet< GUM_SCALAR > & | P, |
const IBayesNet< GUM_SCALAR > & | Q | ||
) |
constructor must give 2 BNs
gum::OperationNotAllowed | if the 2 BNs have not the same domainSize or compatible node sets. |
Definition at line 36 of file exactBNdistance_tpl.h.
|
explicit |
copy constructor
Definition at line 43 of file exactBNdistance_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
virtual |
destructor
Definition at line 49 of file exactBNdistance_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
inherited |
|
finalprotectedvirtual |
Reimplemented from gum::BNdistance< GUM_SCALAR >.
Definition at line 54 of file exactBNdistance_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
inherited |
return KL::Complexity::Heavy,KL::Complexity::Difficult,KL::Complexity::Correct depending on the BNs p and q
Definition at line 68 of file BNdistance_tpl.h.
|
inherited |
Definition at line 103 of file BNdistance_tpl.h.
|
inherited |
Definition at line 109 of file BNdistance_tpl.h.
|
inherited |
|
inherited |
|
inherited |
|
inherited |
|
inherited |
|
protectedinherited |
Definition at line 175 of file BNdistance_tpl.h.
|
inherited |
|
protectedinherited |
Definition at line 151 of file BNdistance.h.
|
protectedinherited |
Definition at line 147 of file BNdistance.h.
|
protectedinherited |
Definition at line 148 of file BNdistance.h.
|
protectedinherited |
Definition at line 150 of file BNdistance.h.
|
protectedinherited |
Definition at line 152 of file BNdistance.h.
|
protectedinherited |
Definition at line 144 of file BNdistance.h.
|
protectedinherited |
Definition at line 145 of file BNdistance.h.
|
protectedinherited |
Definition at line 141 of file BNdistance.h.
|
protectedinherited |
Definition at line 142 of file BNdistance.h.