57#define INFORMATION_THEORY_TEMPLATE \
58 template < template < typename > class INFERENCE_ENGINE, \
65 INFERENCE_ENGINE< GUM_SCALAR >& engine,
70 if ((!(
X_ *
Y_).empty()) || (!(
X_ *
Z_).empty()) || (!(
Z_ *
Y_).empty()))
77 INFERENCE_ENGINE< GUM_SCALAR >& engine,
83 INFERENCE_ENGINE< GUM_SCALAR >& engine,
84 const std::vector< std::string >& Xnames,
85 const std::vector< std::string >& Ynames) :
87 engine.model().nodeset(Xnames),
88 engine.model().nodeset(Ynames),
93 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) :
98 engine.model().nodeset(Xnames),
99 engine.model().nodeset(Ynames),
100 engine.model().nodeset(Znames)) {}
110 for (
const auto x:
X_)
114 for (
const auto y:
Y_)
118 for (
const auto z:
Z_)
122 if (!
engine_.isJointTarget(joint_vars)) {
125 bool implicit_target =
false;
126 for (
const auto node: joint_vars)
127 if (
engine_.model().family(node).isSupersetOrEqual(joint_vars)) {
128 implicit_target =
true;
131 if (!implicit_target) {
132 engine_.eraseAllJointTargets();
133 engine_.addJointTarget(joint_vars);
159 return pXY_.entropy();
166 const auto& pxy =
pXY_[i];
167 if (pxy == GUM_SCALAR(0.0))
return GUM_SCALAR(0.0);
169 const auto& py =
pY_[i];
170 if (py == GUM_SCALAR(0.0))
return GUM_SCALAR(0.0);
180 const auto& pxy =
pXY_[i];
181 if (pxy == GUM_SCALAR(0.0))
return GUM_SCALAR(0.0);
183 const auto& px =
pX_[i];
184 if (px == GUM_SCALAR(0.0))
return GUM_SCALAR(0.0);
195 const auto& pxz =
pXZ_[i];
196 if (pxz == GUM_SCALAR(0.0))
return GUM_SCALAR(0.0);
198 const auto& pz =
pZ_[i];
199 if (pz == GUM_SCALAR(0.0))
return GUM_SCALAR(0.0);
210 const auto& pyz =
pYZ_[i];
211 if (pyz == GUM_SCALAR(0.0))
return GUM_SCALAR(0.0);
213 const auto& pz =
pZ_[i];
214 if (pz == GUM_SCALAR(0.0))
return GUM_SCALAR(0.0);
224 const auto& pxy =
pXY_[i];
225 if (pxy == GUM_SCALAR(0.0))
return GUM_SCALAR(0.0);
227 const auto& pxpy =
pY_[i] *
pX_[i];
228 if (pxpy == GUM_SCALAR(0.0))
return GUM_SCALAR(0.0);
247 const auto& pxyz =
pXYZ_[i];
248 if (pxyz == GUM_SCALAR(0.0))
return GUM_SCALAR(0.0);
250 const auto& pz =
pZ_[i];
251 if (pz == GUM_SCALAR(0.0))
return GUM_SCALAR(0.0);
262 const auto& pxyz =
pXYZ_[i];
263 if (pxyz == GUM_SCALAR(0.0))
return GUM_SCALAR(0.0);
265 const auto& pyz =
pYZ_[i];
266 if (pyz == GUM_SCALAR(0.0))
return GUM_SCALAR(0.0);
277 const auto& pzpxyz =
pXYZ_[i] *
pZ_[i];
278 if (pzpxyz == GUM_SCALAR(0.0))
return GUM_SCALAR(0.0);
280 const auto& pxzpyz =
pXZ_[i] *
pYZ_[i];
281 if (pxzpyz == GUM_SCALAR(0.0))
return GUM_SCALAR(0.0);
287#undef INFORMATION_THEORY_TEMPLATE
Exception base for argument error.
Class for assigning/browsing values to tuples of discrete variables.
Exception : operation not allowed.
#define GUM_ERROR(type, msg)
Set< NodeId > NodeSet
Some typdefs and define for shortcuts ...
Implementation of a Shafer-Shenoy's-like version of lazy propagation for inference in Bayesian networ...
gum is the global namespace for all aGrUM entities