37 template <
typename GUM_SCALAR >
41 _q(Q), _klPQ(0.0), _klQP(0.0), _errorPQ(0), _errorQP(0),
46 double diff =
_p.log10DomainSize();
56 template <
typename GUM_SCALAR >
64 template <
typename GUM_SCALAR >
69 template <
typename GUM_SCALAR >
74 template <
typename GUM_SCALAR >
80 template <
typename GUM_SCALAR >
86 template <
typename GUM_SCALAR >
92 template <
typename GUM_SCALAR >
98 template <
typename GUM_SCALAR >
104 template <
typename GUM_SCALAR >
110 template <
typename GUM_SCALAR >
116 template <
typename GUM_SCALAR >
121 template <
typename GUM_SCALAR >
127 template <
typename GUM_SCALAR >
129 for (
auto node :
_p.nodes()) {
137 "BNdistance : the 2 BNs are not compatible " 138 "(not the same domainSize for " 148 "BNdistance : the 2 BNs are not compatible F(not the same " 155 "BNdistance : the 2 BNs are not compatible (not the same vars : " 161 if (
_p.size() !=
_q.size())
163 "BNdistance : the 2 BNs are not compatible (not the same size)");
165 if (std::fabs(
_p.log10DomainSize() -
_q.log10DomainSize()) > 1e-14) {
168 "BNdistance : the 2 BNs are not compatible (not the same domainSize) : p=" 169 <<
_p.log10DomainSize() <<
" q=" <<
_q.log10DomainSize() <<
" => " 170 <<
_p.log10DomainSize() -
_q.log10DomainSize());
177 template <
typename GUM_SCALAR >
186 template <
typename GUM_SCALAR >
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
Complexity difficulty() const
return KL::Complexity::Heavy,KL::Complexity::Difficult,KL::Complexity::Correct depending on the BNs _...
bool __checkCompatibility() const
const IBayesNet< GUM_SCALAR > & _p
BNdistance(const IBayesNet< GUM_SCALAR > &P, const IBayesNet< GUM_SCALAR > &Q)
constructor must give 2 BNs
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
const IBayesNet< GUM_SCALAR > & p() const
Base class for discrete random variable.
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
Class representing the minimal interface for Bayesian Network.
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
virtual void _computeKL()
Complexity
Complexity allows to characterize the awaited difficulty for an algorithm given a specific instance T...
virtual Size domainSize() const =0
const IBayesNet< GUM_SCALAR > & _q
#define GAP_COMPLEXITY_KL_DIFFICULT_CORRECT
const IBayesNet< GUM_SCALAR > & q() const
virtual std::string label(Idx i) const =0
get the indice-th label. This method is pure virtual.
virtual ~BNdistance()
destructor
Size Idx
Type for indexes.
std::size_t Size
In aGrUM, hashed values are unsigned long int.
#define GAP_COMPLEXITY_KL_HEAVY_DIFFICULT
const std::string & name() const
returns the name of the variable
#define GUM_ERROR(type, msg)