58 template <
typename GUM_SCALAR >
66 double diff =
p_.log10DomainSize();
73 template <
typename GUM_SCALAR >
80 template <
typename GUM_SCALAR >
85 template <
typename GUM_SCALAR >
90 template <
typename GUM_SCALAR >
96 template <
typename GUM_SCALAR >
102 template <
typename GUM_SCALAR >
108 template <
typename GUM_SCALAR >
114 template <
typename GUM_SCALAR >
120 template <
typename GUM_SCALAR >
126 template <
typename GUM_SCALAR >
132 template <
typename GUM_SCALAR >
137 template <
typename GUM_SCALAR >
143 template <
typename GUM_SCALAR >
146 if (
p_.size() !=
q_.size())
148 "BNdistance : the 2 BNs are not compatible (not the same size)")
150 for (
auto node:
p_.nodes()) {
156 "BNdistance : the 2 BNs are not compatible "
157 "(not the same variable for the same name : "
161 "BNdistance : the 2 BNs are not compatible (variable : " + vp.
name() +
")");
165 if (std::fabs(
p_.log10DomainSize() -
q_.log10DomainSize()) > 1e-14) {
167 "BNdistance : the 2 BNs are not compatible (not the same domainSize) : p="
168 <<
p_.log10DomainSize() <<
" q=" <<
q_.log10DomainSize() <<
" => "
169 <<
p_.log10DomainSize() -
q_.log10DomainSize());
176 template <
typename GUM_SCALAR >
185 template <
typename GUM_SCALAR >
algorithm for KL divergence between BNs
#define GAP_COMPLEXITY_KL_DIFFICULT_CORRECT
#define GAP_COMPLEXITY_KL_HEAVY_DIFFICULT
Class representing the minimal interface for Bayesian network with no numerical data.
BNdistance(const IBayesNet< GUM_SCALAR > &P, const IBayesNet< GUM_SCALAR > &Q)
constructor must give 2 BNs
virtual void computeKL_()
bool _checkCompatibility_() const
virtual ~BNdistance()
destructor
const IBayesNet< GUM_SCALAR > & q_
const IBayesNet< GUM_SCALAR > & p() const
const IBayesNet< GUM_SCALAR > & q() const
Complexity difficulty() const
return KL::Complexity::Heavy,KL::Complexity::Difficult,KL::Complexity::Correct depending on the BNs p...
const IBayesNet< GUM_SCALAR > & p_
Base class for discrete random variable.
std::string toString() const
string version of *this
Class representing the minimal interface for Bayesian network with no numerical data.
Exception : the element we looked for cannot be found.
Exception : operation not allowed.
const std::string & name() const
returns the name of the variable
#define GUM_ERROR(type, msg)
std::size_t Size
In aGrUM, hashed values are unsigned long int.
gum is the global namespace for all aGrUM entities
Complexity
Complexity allows to characterize the awaited difficulty for an algorithm given a specific instance T...