![]() |
aGrUM 3.0.0
a C++ library for (probabilistic) graphical models
|
Joint probability term ( \mathbb{P}(\mathrm{vars}) ) in an observational BN. More...
#include <doAST.h>
Public Member Functions | |
| ASTjointProba (const Set< std::string > &varNames) | |
| Build a joint (\mathbb{P}(\mathrm{varNames})). | |
| const Set< std::string > & | varNames () const noexcept |
| std::string | toString (std::string_view prefix="") const override |
| Human-readable multi-line rendering (for debugging / logs). | |
| std::string | protectToLatex (HashTable< std::string, int > &nameOccur) const override |
| LaTeX rendering with full name protection. | |
| std::string | fastToLatex (HashTable< std::string, int > &nameOccur) const override |
| Fast LaTeX rendering (lighter protection). | |
| std::unique_ptr< ASTtree< GUM_SCALAR > > | copy () const override |
| Deep clone of the sub-tree. | |
| Tensor< GUM_SCALAR > | eval (const IBayesNet< GUM_SCALAR > &contextual_bn) const override |
| Evaluate the expression against a contextual BN. | |
| const std::string & | type () const noexcept |
| std::string | toLatex (HashTable< std::string, int > nameOccur=HashTable< std::string, int >()) const |
| Convenience wrapper using an empty occurrence table. | |
Static Protected Member Functions | |
| static std::string | _latexCorrect (std::string_view srcName, HashTable< std::string, int > &nameOccur) |
| Sanitize a single variable name for LaTeX and ensure uniqueness. | |
| static std::vector< std::string > | _latexCorrect (const Set< std::string > &srcNames, HashTable< std::string, int > &nameOccur) |
| Sanitize a set of variable names for LaTeX and ensure uniqueness. | |
Protected Attributes | |
| std::string | _type |
Static Protected Attributes | |
| static constexpr const char * | CONTINUE_PREFIX = "| " |
| Prefix used to draw tree branches in toString. | |
Private Attributes | |
| Set< std::string > | _varNames |
Joint probability term ( \mathbb{P}(\mathrm{vars}) ) in an observational BN.
eval queries the contextual BN for the joint over the listed variables.
|
explicit |
Build a joint (\mathbb{P}(\mathrm{varNames})).
Definition at line 448 of file doAST_tpl.h.
References gum::ASTtree< GUM_SCALAR >::ASTtree(), _varNames, and varNames().
|
staticprotectedinherited |
Sanitize a set of variable names for LaTeX and ensure uniqueness.
Definition at line 89 of file doAST_tpl.h.
References _latexCorrect().
|
staticprotectedinherited |
Sanitize a single variable name for LaTeX and ensure uniqueness.
Definition at line 79 of file doAST_tpl.h.
References gum::HashTable< Key, Val >::getWithDefault().
Referenced by _latexCorrect(), gum::ASTjointProba< GUM_SCALAR >::fastToLatex(), gum::ASTposteriorProba< GUM_SCALAR >::fastToLatex(), gum::ASTsum< GUM_SCALAR >::fastToLatex(), gum::ASTjointProba< GUM_SCALAR >::toString(), and gum::ASTposteriorProba< GUM_SCALAR >::toString().
|
overridevirtual |
Deep clone of the sub-tree.
Implements gum::ASTtree< GUM_SCALAR >.
Definition at line 500 of file doAST_tpl.h.
References _varNames.
|
overridevirtual |
Evaluate the expression against a contextual BN.
| contextual_bn | Bayesian network providing CPTs and variable domains |
Implements gum::ASTtree< GUM_SCALAR >.
Definition at line 506 of file doAST_tpl.h.
References _varNames, gum::JointTargetedInference< GUM_SCALAR >::addJointTarget(), gum::MarginalTargetedInference< GUM_SCALAR >::addTarget(), gum::Set< Key >::begin(), gum::DiscreteGraphicalModel::idFromName(), gum::Set< Key >::insert(), gum::JointTargetedInference< GUM_SCALAR >::jointPosterior(), gum::GraphicalModelInference< GUM_SCALAR >::makeInference(), gum::JointTargetedInference< GUM_SCALAR >::posterior(), and gum::Set< Key >::size().
|
overridevirtual |
Fast LaTeX rendering (lighter protection).
Assumes prior hygiene of names; typically avoids heavier bookkeeping performed in protectToLatex.
| nameOccur | symbol occurrence table (may be consulted/updated) |
Implements gum::ASTtree< GUM_SCALAR >.
Definition at line 486 of file doAST_tpl.h.
References gum::ASTtree< GUM_SCALAR >::_latexCorrect(), and _varNames.
Referenced by protectToLatex().
|
overridevirtual |
LaTeX rendering with full name protection.
Produces LaTeX with variable-name disambiguation, using nameOccur as a registry of encountered names and their occurrence counts.
| nameOccur | symbol occurrence table (updated in place) |
Implements gum::ASTtree< GUM_SCALAR >.
Definition at line 480 of file doAST_tpl.h.
References fastToLatex().
|
inherited |
Convenience wrapper using an empty occurrence table.
Definition at line 73 of file doAST_tpl.h.
References fastToLatex().
Referenced by fastToLatex().
|
overridevirtual |
Human-readable multi-line rendering (for debugging / logs).
| prefix | indentation prefix propagated to children |
Implements gum::ASTtree< GUM_SCALAR >.
Definition at line 460 of file doAST_tpl.h.
References gum::ASTtree< GUM_SCALAR >::_latexCorrect(), and _varNames.
|
noexceptinherited |
Definition at line 68 of file doAST_tpl.h.
References _type.
Referenced by gum::ASTBinaryOp< GUM_SCALAR >::ASTBinaryOp(), ASTtree(), and operator=().
|
noexcept |
Definition at line 455 of file doAST_tpl.h.
References _varNames.
Referenced by ASTjointProba().
|
protectedinherited |
Definition at line 154 of file doAST.h.
Referenced by ASTtree(), gum::ASTBinaryOp< GUM_SCALAR >::toString(), and type().
|
private |
Definition at line 389 of file doAST.h.
Referenced by ASTjointProba(), copy(), eval(), fastToLatex(), toString(), and varNames().
|
staticconstexprprotectedinherited |
Prefix used to draw tree branches in toString.
Definition at line 153 of file doAST.h.
Referenced by gum::ASTBinaryOp< GUM_SCALAR >::toString(), and gum::ASTsum< GUM_SCALAR >::toString().