56#define INFORMATION_THEORY_TEMPLATE \
57 template < template < typename > class INFERENCE_ENGINE, \
64 INFERENCE_ENGINE< GUM_SCALAR >& engine,
69 if ((!(
X_ *
Y_).empty()) || (!(
X_ *
Z_).empty()) || (!(
Z_ *
Y_).empty()))
76 INFERENCE_ENGINE< GUM_SCALAR >& engine,
82 INFERENCE_ENGINE< GUM_SCALAR >& engine,
83 const std::vector< std::string >& Xnames,
84 const std::vector< std::string >& Ynames) :
86 engine.model().nodeset(Xnames),
87 engine.model().nodeset(Ynames),
92 INFERENCE_ENGINE< GUM_SCALAR >& engine,
93 const std::vector< std::string >& Xnames,
94 const std::vector< std::string >& Ynames,
95 const std::vector< std::string >& Znames) :
97 engine.model().nodeset(Xnames),
98 engine.model().nodeset(Ynames),
99 engine.model().nodeset(Znames)) {}
109 for (
const auto x:
X_)
113 for (
const auto y:
Y_)
117 for (
const auto z:
Z_)
121 if (!
engine_.isJointTarget(joint_vars)) {
124 bool implicit_target =
false;
125 for (
const auto node: joint_vars)
126 if (
engine_.model().family(node).isSupersetOrEqual(joint_vars)) {
127 implicit_target =
true;
130 if (!implicit_target) {
131 engine_.eraseAllJointTargets();
132 engine_.addJointTarget(joint_vars);
158 return pXY_.entropy();
165 const auto& pxy =
pXY_[i];
166 if (pxy == GUM_SCALAR(0.0))
return GUM_SCALAR(0.0);
168 const auto& py =
pY_[i];
169 if (py == GUM_SCALAR(0.0))
return GUM_SCALAR(0.0);
179 const auto& pxy =
pXY_[i];
180 if (pxy == GUM_SCALAR(0.0))
return GUM_SCALAR(0.0);
182 const auto& px =
pX_[i];
183 if (px == GUM_SCALAR(0.0))
return GUM_SCALAR(0.0);
194 const auto& pxz =
pXZ_[i];
195 if (pxz == GUM_SCALAR(0.0))
return GUM_SCALAR(0.0);
197 const auto& pz =
pZ_[i];
198 if (pz == GUM_SCALAR(0.0))
return GUM_SCALAR(0.0);
209 const auto& pyz =
pYZ_[i];
210 if (pyz == GUM_SCALAR(0.0))
return GUM_SCALAR(0.0);
212 const auto& pz =
pZ_[i];
213 if (pz == GUM_SCALAR(0.0))
return GUM_SCALAR(0.0);
223 const auto& pxy =
pXY_[i];
224 if (pxy == GUM_SCALAR(0.0))
return GUM_SCALAR(0.0);
226 const auto& pxpy =
pY_[i] *
pX_[i];
227 if (pxpy == GUM_SCALAR(0.0))
return GUM_SCALAR(0.0);
246 const auto& pxyz =
pXYZ_[i];
247 if (pxyz == GUM_SCALAR(0.0))
return GUM_SCALAR(0.0);
249 const auto& pz =
pZ_[i];
250 if (pz == GUM_SCALAR(0.0))
return GUM_SCALAR(0.0);
261 const auto& pxyz =
pXYZ_[i];
262 if (pxyz == GUM_SCALAR(0.0))
return GUM_SCALAR(0.0);
264 const auto& pyz =
pYZ_[i];
265 if (pyz == GUM_SCALAR(0.0))
return GUM_SCALAR(0.0);
276 const auto& pzpxyz =
pXYZ_[i] *
pZ_[i];
277 if (pzpxyz == GUM_SCALAR(0.0))
return GUM_SCALAR(0.0);
279 const auto& pxzpyz =
pXZ_[i] *
pYZ_[i];
280 if (pxzpyz == GUM_SCALAR(0.0))
return GUM_SCALAR(0.0);
286#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