![]() |
aGrUM 3.2.0
a C++ library for (probabilistic) graphical models
|
Exact inference on a gum::KTBN with observations and interventions, by the interface algorithm. More...
#include <agrum/KTBN/inference/KTBNInference.h>
Classes | |
| struct | _Series_ |
| A cached marginal time-series for one base: owned variable descriptors paired with their marginals, indexed by slice (single entry for an atemporal base). Descriptors are owned so tensors get a stable per-slice name rather than the reused ring-slot name they came from. More... | |
| struct | _Slot_ |
One node of a window template: a base (index into baseNames) at a lag behind the window's current slice. lag == ATEMPORAL marks an atemporal base, which sits in every interface and never ages. More... | |
| struct | _Window_ |
| A compiled window: the junction tree of \(H_t = I_{t-1} \cup V_t\), rooted at the clique holding \(I_t\), plus everything needed to fill and message-pass it. Built once; windows 0..k-2 are the initial ones, window k-1 is the repeating one, re-entered from slice k-1 on. More... | |
Public Types | |
| using | NodeKey = std::variant< std::string, std::pair< std::string, int > > |
A node designated either by its engine name ("X[2]", "C") or by its (base, slice) identity. | |
Public Member Functions | |
Constructors / Destructor | |
| KTBNInference (const KTBN< GUM_SCALAR > *ktbn) | |
| Constructor. | |
| ~KTBNInference ()=default | |
| Destructor. | |
| KTBNInference (const KTBNInference< GUM_SCALAR > &)=delete | |
| Copy is disabled (owns per-run variable descriptors and cached tensors). | |
| KTBNInference< GUM_SCALAR > & | operator= (const KTBNInference< GUM_SCALAR > &)=delete |
| Constructor. | |
Interventions | |
| void | addIntervention (std::string_view base, int slice, const KTBNModality &value) |
| Records a hard intervention \(do(base[slice]=value)\). | |
| void | addIntervention (std::string_view node_name, const KTBNModality &value) |
Same, using an engine name ("X[2]", "C", …). | |
| void | addIntervention (const std::vector< std::pair< NodeKey, KTBNModality > > &interventions) |
| Records several interventions in one call. | |
| void | eraseIntervention (std::string_view base, int slice) |
| Removes a recorded intervention (silent no-op if absent). | |
| void | eraseIntervention (std::string_view node_name) |
Same, using an engine name ("X[2]", "C", …). | |
| void | clearInterventions () |
| Removes all recorded interventions. | |
| bool | hasIntervention (std::string_view base, int slice) const |
| bool | hasIntervention (std::string_view node_name) const |
Same, using an engine name ("X[2]", "C", …). | |
Observations | |
| void | addObservation (std::string_view base, int slice, const KTBNModality &value) |
| Records a hard observation \(base[slice]=value\). | |
| void | addObservation (std::string_view node_name, const KTBNModality &value) |
Same, using an engine name ("X[2]", "C", …). | |
| void | addObservation (std::string_view base, int slice, const std::vector< GUM_SCALAR > &likelihood) |
| Records a soft (likelihood) observation on \(base[slice]\). | |
| void | addObservation (std::string_view node_name, const std::vector< GUM_SCALAR > &likelihood) |
Same, using an engine name ("X[2]", "C", …). | |
| void | addObservations (const std::vector< std::pair< NodeKey, KTBNModality > > &observations) |
| Records several observations in one call, all-or-nothing. | |
| void | eraseObservation (std::string_view base, int slice) |
| Removes a recorded observation (silent no-op if absent). | |
| void | eraseObservation (std::string_view node_name) |
Same, using an engine name ("X[2]", "C", …). | |
| void | clearObservation () |
| Removes all recorded observations. | |
| bool | hasObservation (std::string_view base, int slice) const |
| bool | hasObservation (std::string_view node_name) const |
Same, using an engine name ("X[2]", "C", …). | |
| bool | hasObservation () const |
Targets | |
| void | addTarget (std::string_view base) |
| Declares a target: a base variable whose marginals we want. | |
| void | eraseTarget (std::string_view base) |
| Removes a target; when the last one is removed, default-all-targets mode is restored. | |
| void | clearTargets () |
| Removes all targets (restores default-all-targets mode). | |
| bool | isTarget (std::string_view base) const |
| bool | isInTargetMode () const |
Inference | |
| void | makeInference (Size nbTimeSlices) |
Runs the interface algorithm over nbTimeSlices slices ( \(0..nbTimeSlices-1\)) and caches, for every targeted base, its marginal at every slice. | |
| const Tensor< GUM_SCALAR > & | posterior (std::string_view base, int slice) |
| Returns \(P(base[slice] \mid \text{obs}, do(\cdot))\). | |
| const Tensor< GUM_SCALAR > & | posterior (std::string_view node_name) |
Same, using an engine name ("X[2]", "C", …). | |
| const std::vector< Tensor< GUM_SCALAR > > & | posteriors (std::string_view base) |
The whole marginal time-series of a targeted base: tensors[t] is \(P(base[t] \mid \cdot)\) for \(t = 0..T-1\) (a single-element vector, holding the atemporal marginal, for an atemporal base). | |
| GUM_SCALAR | logObservationProbability () |
| \(\log P(\text{obs} \mid do(\cdot))\) for the last run: the likelihood of the observations under the (possibly mutilated) model. 0 when nothing is observed. Lazily (re)runs makeInference() if out of date. | |
| GUM_SCALAR | observationProbability () |
| \(P(\text{obs} \mid do(\cdot))\), i.e. exp of logObservationProbability(). Underflows to 0 on long horizons; prefer the log form. | |
Various | |
| const KTBN< GUM_SCALAR > & | ktbn () const |
| std::string | toString () const |
| const JunctionTree & | windowJunctionTree () const |
| The junction tree of the repeating window – the one compiled from the k-slice template and re-entered at every step from slice \(k-1\) on. Introspection only. | |
| Size | interfaceSize () const |
| Size of the forward interface of the repeating window: how many node occurrences have to cross each slice boundary. Introspection only. | |
Static Public Attributes | |
| static constexpr int | ATEMPORAL = KTBN< GUM_SCALAR >::ATEMPORAL |
| Convenience alias for the atemporal-slice sentinel. | |
Private Member Functions | |
| Size | _psiKey_ (int t) const |
Cache slot for slice t: the initial slices keep their own, the repeating window contributes one per phase. | |
Runtime | |
| const _Window_ & | _windowAt_ (int t) const |
The window for absolute slice t: its own while t is inside the initial block, the repeating one (index k) from then on. | |
| const std::unordered_map< NodeId, Tensor< GUM_SCALAR > > & | _windowPotentials_ (const _Window_ &w, int t) const |
Clique potentials of the window at slice t: every requisite family's CPT (or, under an intervention, a point mass severing it from its causes), times every observation's likelihood. | |
| void | _applyTemporalObservations_ (const _Window_ &w, int t, std::unordered_map< NodeId, Tensor< GUM_SCALAR > > &psi) const |
Multiplies slice t's temporal observation likelihoods into an already-built base. Atemporal ones are skipped: the base holds them. | |
| void | _fillWindow_ (const _Window_ &w, int t, std::unordered_map< NodeId, Tensor< GUM_SCALAR > > &psi, bool withTemporalEvidence=true) const |
| void | _propagate_ (const _Window_ &w, int t, const std::unordered_map< NodeId, Tensor< GUM_SCALAR > > &psi, const Tensor< GUM_SCALAR > *inPrev, const Tensor< GUM_SCALAR > *inNext, bool distribute, std::map< std::pair< NodeId, NodeId >, Tensor< GUM_SCALAR > > &msgs) const |
Shafer-Shenoy pass over a filled window. inPrev / inNext are the interface messages arriving at rootD / rootC (null when absent); division-free, so deterministic potentials need no special casing. | |
| Tensor< GUM_SCALAR > | _belief_ (const _Window_ &w, const std::unordered_map< NodeId, Tensor< GUM_SCALAR > > &psi, const std::map< std::pair< NodeId, NodeId >, Tensor< GUM_SCALAR > > &msgs, const Tensor< GUM_SCALAR > *inPrev, const Tensor< GUM_SCALAR > *inNext, NodeId c, NodeId skipNeighbour) const |
The belief of clique c: its potential times every message reaching it, interface messages included. | |
| void | _snapshot_ (const std::string &base, int slice, const Tensor< GUM_SCALAR > &marginal) |
Snapshots marginal onto an owned, stably-named descriptor and appends it to that base's series (index == slice for a temporal base). Positional fillWith, not name-matched: marginal's axis is a shared ring object, reused across residue-k slices, whose name generally isn't base[slice]. | |
| const _Series_ & | _series_ (const std::string &base) |
The cached series of a targeted base, running makeInference() lazily (with the last horizon) if out of date. Shared by both accessors. | |
Private Attributes | |
| const KTBN< GUM_SCALAR > * | _ktbn_ |
| The k-DBN (referenced, not owned). | |
| int | _k_ |
| The order k, cached as int for slice arithmetic. | |
| std::map< std::string, Idx > | _interventions_ |
| Recorded interventions, keyed by engine name -> forced value. | |
| std::map< std::string, std::vector< GUM_SCALAR > > | _observations_ |
| Recorded observations, keyed by engine name -> likelihood vector (one-hot for a hard observation). | |
| std::set< std::string > | _targets_ |
| Recorded targets (base names). Empty <=> default-all-targets mode. | |
| bool | _targeted_mode_ {false} |
| Whether at least one explicit target has been declared. | |
| Size | _horizon_ {0} |
| Horizon (nbTimeSlices) of the last/next run; 0 <=> makeInference never run. | |
| bool | _done_ {false} |
| Whether the cached posteriors are up to date. | |
| GUM_SCALAR | _logObservation_ {0} |
| log P(observation | do) of the last run. | |
| std::unordered_map< std::string, _Series_ > | _posteriors_ |
| Cached marginal series of the last run, keyed by base name. | |
| std::vector< std::string > | _temporalSorted_ |
| Temporal / atemporal base names in a deterministic (sorted) order, cached once at construction (the KTBN's own sets are unordered). | |
| std::vector< std::string > | _atemporalSorted_ |
| std::vector< std::string > | _baseNames_ |
| All bases: temporal first (indices 0.._nbTemporal_-1), then atemporal. Window slots index into this. | |
| std::size_t | _nbTemporal_ {0} |
| std::unordered_map< std::string, int > | _baseIdx_ |
| name -> index into baseNames | |
| std::vector< int > | _maxLag_ |
| maxLag[i]: largest lag at which the transition kernel still consumes temporal base i – how long an occurrence must stay in the interface, which is what makes |I| finite and the window template time-invariant. | |
| std::vector< _Window_ > | _windows_ |
| The compiled windows: index t for t <= k-2 (initial), index k-1 for the repeating window, reused by every slice from k-1 on. Built once. | |
| std::vector< bool > | _requisite_ |
| Bases actually folded by the current run: the targets, the observed nodes and all their ancestors. Rebuilt per makeInference() from the current target/observation sets; anything outside is barren and cannot move an answer. | |
| std::vector< std::unordered_map< NodeId, Tensor< GUM_SCALAR > > > | _psiCache_ |
| Memoized clique potentials for the slices that carry no temporal evidence, indexed by psiKey(t). Sized 2k: the k initial slices have their own windows and their own CPTs, the repeating one contributes k phases. O(k) whatever the horizon – unlike keeping one per slice, which would make smoothing grow linearly in T. | |
| std::vector< bool > | _psiCached_ |
| std::unordered_set< int > | _observationSlices_ |
| Slices carrying a temporal observation. Their potentials are the periodic ones times that slice's likelihood, so they are served by copying the cached base and multiplying the evidence in – cheaper than a rebuild, which would redo the unit fill and every CPT product. | |
| std::unordered_set< int > | _interventionSlices_ |
| Slices carrying a temporal intervention. These need a full rebuild: do(X=x) replaces the node's CPT, which the cached base has already multiplied in, so the base is unusable rather than merely incomplete. Atemporal evidence appears in neither set – it applies at every slice alike and so belongs to the periodic structure. | |
| std::unordered_map< NodeId, Tensor< GUM_SCALAR > > | _psiScratch_ |
| Potentials of an evidence-carrying slice, rebuilt on each visit. | |
| std::map< std::pair< std::string, int >, Tensor< GUM_SCALAR > > | _kernelCache_ |
Memoized transition kernels, keyed by (process, t % k). | |
Structural helpers | |
| bool | _isTemporal_ (const std::string &base) const |
| bool | _isAtemporal_ (const std::string &base) const |
| std::pair< std::string, int > | _determineNode_ (const std::string &name) const |
| Cache-aware classification of an engine name -> (base, slice): a name registered as atemporal (incl. bracket-shaped) maps to ATEMPORAL, every other name is parsed syntactically. Mirrors KTBN::determineNode. | |
| void | _validateNode_ (const std::string &base, int slice) const |
| Validates that (base, slice) denotes a legal node (future slices ok). | |
| const DiscreteVariable & | _templateVar_ (const std::string &base, int slice) const |
A representative template variable of base for domain/cloning. | |
| const DiscreteVariable * | _varOfSlot_ (const _Slot_ &s, int t) const |
The variable a window slot stands for at absolute slice t: ring slot \((t-\text{lag}) \bmod k\) for a temporal base, the atemporal object otherwise. This is where "advance one slice" happens – a relabelling, not an allocation. | |
| const Tensor< GUM_SCALAR > & | _buildKernel_ (const std::string &p, int t) const |
Transition-kernel tensor of process p at slice t ( \(t \geq k\)): the template kernel remapped onto the k-DBN's own per-slice objects, reused via slice % k (no allocation). | |
| std::vector< _Slot_ > | _familySlots_ (int baseIdx, int t) const |
Parents of base at a window whose current slice is t, as slots (lag = t - parentSlice). Uses the initial CPT structure for \(t \leq k-2\), the transition kernel from \(k-1\) on – which is why the repeating window is compiled from slice k-1's families. | |
| std::vector< _Slot_ > | _interfaceAfter_ (int t) const |
The forward interface after slice t, as slots relative to t: every requisite occurrence at a slice \(\leq t\) still coupled to the future, plus every requisite atemporal base. From \(t=k-2\) on this is the steady \(\{(p,\delta): \delta < maxLag(p)\}\) – why one repeating window suffices. | |
| int | _lastConsumerSlice_ (int baseIdx, int s) const |
The last slice at which occurrence base[s] is still consumed (-1 if never), over both the initial families and the transition kernel. | |
| void | _buildWindows_ () |
| Compiles the k window junction trees, once, from the constructor: moralise each window's families, force \(I_{t-1}\) and \(I_t\) into cliques, triangulate, root at \(C_t\), and assign every family factor to a clique that covers it. | |
| _Window_ | _compileWindow_ (const std::vector< _Slot_ > &Iprev, const std::vector< _Slot_ > &Icur, int t, bool withAtemporalFamilies) const |
| Compiles one window over the given slot set / interfaces. | |
| void | _markRequisite_ () |
| Marks the requisite bases of the current run (targets, observed bases and all their ancestors) into requisite. | |
| static std::string | _encode_ (const std::string &base, int slice) |
Encodes (base, slice) -> engine name (base[slice] or bare base). | |
Exact inference on a gum::KTBN with observations and interventions, by the interface algorithm.
Definition at line 147 of file KTBNInference.h.
| using gum::KTBNInference< GUM_SCALAR >::NodeKey = std::variant< std::string, std::pair< std::string, int > > |
A node designated either by its engine name ("X[2]", "C") or by its (base, slice) identity.
Definition at line 175 of file KTBNInference.h.
|
explicit |
Constructor.
| ktbn | The k-DBN to reason about (referenced, not copied). |
| InvalidArgument | if ktbn is null. |
Definition at line 74 of file KTBNInference_tpl.h.
References _atemporalSorted_, _baseIdx_, _baseNames_, _buildWindows_(), _k_, _ktbn_, _nbTemporal_, _requisite_, _temporalSorted_, GUM_ERROR, and ktbn().
Referenced by KTBNInference(), and operator=().
|
default |
Destructor.
|
delete |
Copy is disabled (owns per-run variable descriptors and cached tensors).
References KTBNInference().
|
private |
Multiplies slice t's temporal observation likelihoods into an already-built base. Atemporal ones are skipped: the base holds them.
Definition at line 761 of file KTBNInference_tpl.h.
References _baseNames_, _encode_(), _k_, _ktbn_, _nbTemporal_, _observations_, and gum::KTBNInference< GUM_SCALAR >::_Window_::factorsOf.
Referenced by _windowPotentials_().
|
private |
The belief of clique c: its potential times every message reaching it, interface messages included.
Definition at line 892 of file KTBNInference_tpl.h.
References gum::KTBNInference< GUM_SCALAR >::_Window_::jt, gum::EdgeGraphPart::neighbours(), gum::KTBNInference< GUM_SCALAR >::_Window_::rootC, and gum::KTBNInference< GUM_SCALAR >::_Window_::rootD.
Referenced by _propagate_(), and makeInference().
|
private |
Transition-kernel tensor of process p at slice t ( \(t \geq k\)): the template kernel remapped onto the k-DBN's own per-slice objects, reused via slice % k (no allocation).
Memoized in kernelCache: the result depends on t only through t % k, so at most \(k\) tensors exist per process however long the horizon. Returns a reference into the cache – valid until the next makeInference(), which clears it.
Definition at line 725 of file KTBNInference_tpl.h.
References _encode_(), _k_, _kernelCache_, _ktbn_, and ATEMPORAL.
Referenced by _fillWindow_().
|
private |
Compiles the k window junction trees, once, from the constructor: moralise each window's families, force \(I_{t-1}\) and \(I_t\) into cliques, triangulate, root at \(C_t\), and assign every family factor to a clique that covers it.
Definition at line 634 of file KTBNInference_tpl.h.
References _baseIdx_, _baseNames_, _compileWindow_(), _interfaceAfter_(), _k_, _ktbn_, _maxLag_, _nbTemporal_, _requisite_, _windows_, and ATEMPORAL.
Referenced by KTBNInference(), and _markRequisite_().
|
private |
Compiles one window over the given slot set / interfaces.
Definition at line 458 of file KTBNInference_tpl.h.
References _baseNames_, _familySlots_(), _k_, _ktbn_, _nbTemporal_, _requisite_, gum::CliqueGraph::addEdge(), ATEMPORAL, gum::KTBNInference< GUM_SCALAR >::_Window_::bfs, gum::CliqueGraph::clique(), gum::Set< Key >::contains(), gum::KTBNInference< GUM_SCALAR >::_Window_::factorsOf, GUM_ERROR, gum::KTBNInference< GUM_SCALAR >::_Window_::Icur, gum::HashTable< Key, Val >::insert(), gum::KTBNInference< GUM_SCALAR >::_Window_::Iprev, gum::KTBNInference< GUM_SCALAR >::_Window_::jt, gum::StaticTriangulation::junctionTree(), gum::EdgeGraphPart::neighbours(), gum::NodeGraphPart::nodes(), gum::KTBNInference< GUM_SCALAR >::_Window_::parentOf, gum::KTBNInference< GUM_SCALAR >::_Window_::rootC, gum::KTBNInference< GUM_SCALAR >::_Window_::rootD, gum::KTBNInference< GUM_SCALAR >::_Window_::selfClique, gum::NodeGraphPart::size(), and gum::KTBNInference< GUM_SCALAR >::_Window_::slotOfNode.
Referenced by _buildWindows_().
|
private |
Cache-aware classification of an engine name -> (base, slice): a name registered as atemporal (incl. bracket-shaped) maps to ATEMPORAL, every other name is parsed syntactically. Mirrors KTBN::determineNode.
Definition at line 109 of file KTBNInference_tpl.h.
References _ktbn_, ATEMPORAL, and GUM_ERROR.
Referenced by _markRequisite_(), addIntervention(), addIntervention(), addObservation(), addObservation(), addObservations(), eraseIntervention(), eraseObservation(), hasIntervention(), hasObservation(), makeInference(), and posterior().
|
staticprivate |
Encodes (base, slice) -> engine name (base[slice] or bare base).
Definition at line 102 of file KTBNInference_tpl.h.
References ATEMPORAL.
Referenced by _applyTemporalObservations_(), _buildKernel_(), _fillWindow_(), _snapshot_(), addIntervention(), addIntervention(), addObservation(), addObservation(), addObservations(), eraseIntervention(), eraseObservation(), hasIntervention(), and hasObservation().
|
private |
Parents of base at a window whose current slice is t, as slots (lag = t - parentSlice). Uses the initial CPT structure for \(t \leq k-2\), the transition kernel from \(k-1\) on – which is why the repeating window is compiled from slice k-1's families.
Definition at line 387 of file KTBNInference_tpl.h.
References _baseIdx_, _baseNames_, _k_, _ktbn_, _nbTemporal_, and ATEMPORAL.
Referenced by _compileWindow_().
|
private |
| withTemporalEvidence | false builds the base: the periodic part only, i.e. CPTs/kernels plus atemporal evidence, with slice t's own observations and interventions left out. That is what psiCache stores. |
Definition at line 813 of file KTBNInference_tpl.h.
References _baseNames_, _buildKernel_(), _encode_(), _interventions_, _k_, _ktbn_, _nbTemporal_, _observations_, _varOfSlot_(), ATEMPORAL, gum::CliqueGraph::clique(), gum::Tensor< GUM_SCALAR >::deterministicTensor(), gum::KTBNInference< GUM_SCALAR >::_Window_::factorsOf, gum::KTBNInference< GUM_SCALAR >::_Window_::jt, gum::NodeGraphPart::nodes(), and gum::KTBNInference< GUM_SCALAR >::_Window_::slotOfNode.
Referenced by _windowPotentials_().
|
private |
The forward interface after slice t, as slots relative to t: every requisite occurrence at a slice \(\leq t\) still coupled to the future, plus every requisite atemporal base. From \(t=k-2\) on this is the steady \(\{(p,\delta): \delta < maxLag(p)\}\) – why one repeating window suffices.
Definition at line 442 of file KTBNInference_tpl.h.
References _baseNames_, _k_, _lastConsumerSlice_(), _nbTemporal_, _requisite_, and ATEMPORAL.
Referenced by _buildWindows_().
|
private |
base is an atemporal variable of the k-DBN. Definition at line 881 of file KTBNInference_tpl.h.
References _ktbn_.
Referenced by _validateNode_(), addTarget(), isTarget(), and posterior().
|
private |
base is a temporal process of the k-DBN. Definition at line 876 of file KTBNInference_tpl.h.
References _ktbn_.
Referenced by _validateNode_(), addTarget(), and isTarget().
|
private |
The last slice at which occurrence base[s] is still consumed (-1 if never), over both the initial families and the transition kernel.
Definition at line 412 of file KTBNInference_tpl.h.
References _baseIdx_, _baseNames_, _k_, _ktbn_, _maxLag_, _nbTemporal_, _requisite_, and ATEMPORAL.
Referenced by _interfaceAfter_().
|
private |
Marks the requisite bases of the current run (targets, observed bases and all their ancestors) into requisite.
Definition at line 669 of file KTBNInference_tpl.h.
References _baseIdx_, _baseNames_, _buildWindows_(), _determineNode_(), _k_, _ktbn_, _nbTemporal_, _observations_, _requisite_, _targeted_mode_, _targets_, and ATEMPORAL.
Referenced by makeInference().
|
private |
Shafer-Shenoy pass over a filled window. inPrev / inNext are the interface messages arriving at rootD / rootC (null when absent); division-free, so deterministic potentials need no special casing.
| msgs | out: (from,to) clique message. Collect-only when distribute is false – enough for the forward message alone. |
Definition at line 914 of file KTBNInference_tpl.h.
References _belief_(), _varOfSlot_(), gum::KTBNInference< GUM_SCALAR >::_Window_::bfs, gum::Set< Key >::insert(), gum::KTBNInference< GUM_SCALAR >::_Window_::jt, gum::EdgeGraphPart::neighbours(), gum::KTBNInference< GUM_SCALAR >::_Window_::parentOf, gum::KTBNInference< GUM_SCALAR >::_Window_::rootC, gum::CliqueGraph::separator(), and gum::KTBNInference< GUM_SCALAR >::_Window_::slotOfNode.
Referenced by makeInference().
|
private |
Cache slot for slice t: the initial slices keep their own, the repeating window contributes one per phase.
Definition at line 778 of file KTBNInference_tpl.h.
References _k_.
Referenced by _windowPotentials_().
|
private |
The cached series of a targeted base, running makeInference() lazily (with the last horizon) if out of date. Shared by both accessors.
Definition at line 1156 of file KTBNInference_tpl.h.
References _done_, _horizon_, _posteriors_, GUM_ERROR, and makeInference().
Referenced by posterior(), and posteriors().
|
private |
Snapshots marginal onto an owned, stably-named descriptor and appends it to that base's series (index == slice for a temporal base). Positional fillWith, not name-matched: marginal's axis is a shared ring object, reused across residue-k slices, whose name generally isn't base[slice].
Definition at line 1131 of file KTBNInference_tpl.h.
References _encode_(), _posteriors_, _templateVar_(), ATEMPORAL, gum::KTBNInference< GUM_SCALAR >::_Series_::tensors, and gum::KTBNInference< GUM_SCALAR >::_Series_::vars.
Referenced by makeInference().
|
private |
A representative template variable of base for domain/cloning.
Definition at line 147 of file KTBNInference_tpl.h.
References _k_, _ktbn_, and ATEMPORAL.
Referenced by _snapshot_(), addIntervention(), addIntervention(), addObservation(), addObservation(), and addObservations().
|
private |
Validates that (base, slice) denotes a legal node (future slices ok).
Definition at line 135 of file KTBNInference_tpl.h.
References _isAtemporal_(), _isTemporal_(), ATEMPORAL, and GUM_ERROR.
Referenced by addIntervention(), addIntervention(), addObservation(), addObservation(), and addObservations().
|
private |
The variable a window slot stands for at absolute slice t: ring slot \((t-\text{lag}) \bmod k\) for a temporal base, the atemporal object otherwise. This is where "advance one slice" happens – a relabelling, not an allocation.
Definition at line 154 of file KTBNInference_tpl.h.
References _baseNames_, _k_, _ktbn_, ATEMPORAL, gum::KTBNInference< GUM_SCALAR >::_Slot_::base, and gum::KTBNInference< GUM_SCALAR >::_Slot_::lag.
Referenced by _fillWindow_(), _propagate_(), and makeInference().
|
private |
The window for absolute slice t: its own while t is inside the initial block, the repeating one (index k) from then on.
Definition at line 887 of file KTBNInference_tpl.h.
References _k_, and _windows_.
Referenced by makeInference().
|
private |
Clique potentials of the window at slice t: every requisite family's CPT (or, under an intervention, a point mass severing it from its causes), times every observation's likelihood.
| psi | out: clique -> its potential (absent clique == unit potential). |
Clique potentials for slice t, memoized where they repeat.
psi(t) reads t in exactly four places: windowAt (fixed at windows[k] once t >= k), varOfSlot ((t - lag) % k), buildKernel (t % k) and the encode(base, t) lookups into observations / interventions. The first three are periodic in t % k, so on a slice carrying no temporal evidence the whole map is too: one entry serves every slice of that phase.
Atemporal evidence needs no special case – it applies identically at every slice, so it is part of the periodic structure.
Returns a reference into the cache (or into a scratch map for a slice that does carry evidence). Valid until the next call, and until the next makeInference(), which clears the cache. Callers only read it: propagate and belief both take psi by const reference.
Definition at line 788 of file KTBNInference_tpl.h.
References _applyTemporalObservations_(), _fillWindow_(), _interventionSlices_, _observationSlices_, _psiCache_, _psiCached_, _psiKey_(), and _psiScratch_.
Referenced by makeInference().
| void gum::KTBNInference< GUM_SCALAR >::addIntervention | ( | const std::vector< std::pair< NodeKey, KTBNModality > > & | interventions | ) |
Records several interventions in one call.
Each entry is a (node, value) pair: node keyed by engine name or by (base, slice), value an index or a label – freely mixed.
All-or-nothing: every entry is validated before any is recorded. A node listed twice keeps its last value.
(base, slice) key needs an explicit std::pair{...}: a bare {"Z", 2} cannot implicitly construct the variant (same rule as gum::KTBN::fillCPT()).| NotFound | / InvalidArgument / OutOfBounds – same as the single-node form, raised before anything is recorded. |
Definition at line 181 of file KTBNInference_tpl.h.
References _determineNode_(), _done_, _encode_(), _interventions_, _templateVar_(), and _validateNode_().
| void gum::KTBNInference< GUM_SCALAR >::addIntervention | ( | std::string_view | base, |
| int | slice, | ||
| const KTBNModality & | value ) |
Records a hard intervention \(do(base[slice]=value)\).
Recorded only; applied at makeInference(). Re-intervening overwrites. value is a modality index or label (see gum::KTBNModality).
| NotFound | if base is unknown. |
| InvalidArgument | if the slice is invalid for the variable kind. |
| OutOfBounds | / NotFound if value is out of the variable's domain or is not one of its modality labels. |
Definition at line 164 of file KTBNInference_tpl.h.
References _done_, _encode_(), _interventions_, _templateVar_(), _validateNode_(), and gum::KTBNModality::toIndex().
Referenced by addIntervention().
| void gum::KTBNInference< GUM_SCALAR >::addIntervention | ( | std::string_view | node_name, |
| const KTBNModality & | value ) |
Same, using an engine name ("X[2]", "C", …).
Definition at line 174 of file KTBNInference_tpl.h.
References _determineNode_(), and addIntervention().
| void gum::KTBNInference< GUM_SCALAR >::addObservation | ( | std::string_view | base, |
| int | slice, | ||
| const KTBNModality & | value ) |
Records a hard observation \(base[slice]=value\).
Unlike an intervention, an observation is conditioning: it revises the whole network, ancestors included. Recorded only; applied at makeInference(). Re-observing overwrites. value is a modality index or label (see gum::KTBNModality).
| NotFound | if base is unknown. |
| InvalidArgument | if the slice is invalid for the variable kind. |
| OutOfBounds | / NotFound if value is not a legal modality. |
Definition at line 234 of file KTBNInference_tpl.h.
References _done_, _encode_(), _observations_, _templateVar_(), _validateNode_(), gum::DiscreteVariable::domainSize(), and gum::KTBNModality::toIndex().
Referenced by addObservation(), and addObservation().
| void gum::KTBNInference< GUM_SCALAR >::addObservation | ( | std::string_view | base, |
| int | slice, | ||
| const std::vector< GUM_SCALAR > & | likelihood ) |
Records a soft (likelihood) observation on \(base[slice]\).
likelihood[i] is the likelihood of the observation given that the node takes its i-th modality; it need not sum to 1, but must be non-negative and not all-zero. A one-hot vector is equivalent to a hard observation.
| NotFound | / InvalidArgument as above. |
| InvalidArgument | if likelihood has the wrong length, holds a negative entry, or is all zeros. |
Definition at line 255 of file KTBNInference_tpl.h.
References _done_, _encode_(), _observations_, _templateVar_(), _validateNode_(), gum::DiscreteVariable::domainSize(), and GUM_ERROR.
| void gum::KTBNInference< GUM_SCALAR >::addObservation | ( | std::string_view | node_name, |
| const KTBNModality & | value ) |
Same, using an engine name ("X[2]", "C", …).
Definition at line 248 of file KTBNInference_tpl.h.
References _determineNode_(), and addObservation().
| void gum::KTBNInference< GUM_SCALAR >::addObservation | ( | std::string_view | node_name, |
| const std::vector< GUM_SCALAR > & | likelihood ) |
Same, using an engine name ("X[2]", "C", …).
Definition at line 280 of file KTBNInference_tpl.h.
References _determineNode_(), and addObservation().
| void gum::KTBNInference< GUM_SCALAR >::addObservations | ( | const std::vector< std::pair< NodeKey, KTBNModality > > & | observations | ) |
Records several observations in one call, all-or-nothing.
Same keying rules (and the same std::pair{...} warning) as the batch addIntervention().
Definition at line 287 of file KTBNInference_tpl.h.
References _determineNode_(), _done_, _encode_(), _observations_, _templateVar_(), _validateNode_(), and gum::DiscreteVariable::domainSize().
| void gum::KTBNInference< GUM_SCALAR >::addTarget | ( | std::string_view | base | ) |
Declares a target: a base variable whose marginals we want.
A temporal base yields one marginal per slice \(0..T-1\) at makeInference(T); an atemporal base yields its single marginal. The first declared target switches the engine out of default-all-targets mode. Recorded only; applied at makeInference().
| NotFound | if base is neither a temporal process nor an atemporal variable of the k-DBN. |
Definition at line 346 of file KTBNInference_tpl.h.
References _done_, _isAtemporal_(), _isTemporal_(), _targeted_mode_, _targets_, and GUM_ERROR.
| void gum::KTBNInference< GUM_SCALAR >::clearInterventions | ( | ) |
Removes all recorded interventions.
Definition at line 213 of file KTBNInference_tpl.h.
References _done_, and _interventions_.
| void gum::KTBNInference< GUM_SCALAR >::clearObservation | ( | ) |
Removes all recorded observations.
Definition at line 320 of file KTBNInference_tpl.h.
References _done_, and _observations_.
| void gum::KTBNInference< GUM_SCALAR >::clearTargets | ( | ) |
Removes all targets (restores default-all-targets mode).
Definition at line 363 of file KTBNInference_tpl.h.
References _done_, _targeted_mode_, and _targets_.
| void gum::KTBNInference< GUM_SCALAR >::eraseIntervention | ( | std::string_view | base, |
| int | slice ) |
Removes a recorded intervention (silent no-op if absent).
Definition at line 201 of file KTBNInference_tpl.h.
References _done_, _encode_(), and _interventions_.
Referenced by eraseIntervention().
| void gum::KTBNInference< GUM_SCALAR >::eraseIntervention | ( | std::string_view | node_name | ) |
Same, using an engine name ("X[2]", "C", …).
Definition at line 207 of file KTBNInference_tpl.h.
References _determineNode_(), and eraseIntervention().
| void gum::KTBNInference< GUM_SCALAR >::eraseObservation | ( | std::string_view | base, |
| int | slice ) |
Removes a recorded observation (silent no-op if absent).
Definition at line 308 of file KTBNInference_tpl.h.
References _done_, _encode_(), and _observations_.
Referenced by eraseObservation().
| void gum::KTBNInference< GUM_SCALAR >::eraseObservation | ( | std::string_view | node_name | ) |
Same, using an engine name ("X[2]", "C", …).
Definition at line 314 of file KTBNInference_tpl.h.
References _determineNode_(), and eraseObservation().
| void gum::KTBNInference< GUM_SCALAR >::eraseTarget | ( | std::string_view | base | ) |
Removes a target; when the last one is removed, default-all-targets mode is restored.
Definition at line 356 of file KTBNInference_tpl.h.
References _done_, _targeted_mode_, and _targets_.
| bool gum::KTBNInference< GUM_SCALAR >::hasIntervention | ( | std::string_view | base, |
| int | slice ) const |
true if base at slice carries an intervention. Definition at line 219 of file KTBNInference_tpl.h.
References _encode_(), and _interventions_.
Referenced by hasIntervention().
| bool gum::KTBNInference< GUM_SCALAR >::hasIntervention | ( | std::string_view | node_name | ) | const |
Same, using an engine name ("X[2]", "C", …).
Definition at line 224 of file KTBNInference_tpl.h.
References _determineNode_(), and hasIntervention().
| bool gum::KTBNInference< GUM_SCALAR >::hasObservation | ( | ) | const |
true if any observation is recorded. When false, makeInference() needs no backward pass and runs in horizon-independent memory. Definition at line 337 of file KTBNInference_tpl.h.
References _observations_.
| bool gum::KTBNInference< GUM_SCALAR >::hasObservation | ( | std::string_view | base, |
| int | slice ) const |
true if base at slice carries an observation. Definition at line 326 of file KTBNInference_tpl.h.
References _encode_(), and _observations_.
Referenced by hasObservation(), and makeInference().
| bool gum::KTBNInference< GUM_SCALAR >::hasObservation | ( | std::string_view | node_name | ) | const |
Same, using an engine name ("X[2]", "C", …).
Definition at line 331 of file KTBNInference_tpl.h.
References _determineNode_(), and hasObservation().
| Size gum::KTBNInference< GUM_SCALAR >::interfaceSize | ( | ) | const |
Size of the forward interface of the repeating window: how many node occurrences have to cross each slice boundary. Introspection only.
Definition at line 1229 of file KTBNInference_tpl.h.
References _k_, and _windows_.
Referenced by toString().
| bool gum::KTBNInference< GUM_SCALAR >::isInTargetMode | ( | ) | const |
true iff at least one explicit target has been declared; when false, every base is a target. Mirrors gum::MarginalTargetedInference::isInTargetMode(). Definition at line 377 of file KTBNInference_tpl.h.
References _targeted_mode_.
| bool gum::KTBNInference< GUM_SCALAR >::isTarget | ( | std::string_view | base | ) | const |
true if base is a target of the next inference. Definition at line 370 of file KTBNInference_tpl.h.
References _isAtemporal_(), _isTemporal_(), _targeted_mode_, and _targets_.
| const KTBN< GUM_SCALAR > & gum::KTBNInference< GUM_SCALAR >::ktbn | ( | ) | const |
Definition at line 1219 of file KTBNInference_tpl.h.
References _ktbn_.
Referenced by KTBNInference().
| GUM_SCALAR gum::KTBNInference< GUM_SCALAR >::logObservationProbability | ( | ) |
\(\log P(\text{obs} \mid do(\cdot))\) for the last run: the likelihood of the observations under the (possibly mutilated) model. 0 when nothing is observed. Lazily (re)runs makeInference() if out of date.
| OperationNotAllowed | if makeInference() has never been run. |
Definition at line 1200 of file KTBNInference_tpl.h.
References _done_, _horizon_, _logObservation_, GUM_ERROR, and makeInference().
Referenced by observationProbability().
| void gum::KTBNInference< GUM_SCALAR >::makeInference | ( | Size | nbTimeSlices | ) |
Runs the interface algorithm over nbTimeSlices slices ( \(0..nbTimeSlices-1\)) and caches, for every targeted base, its marginal at every slice.
A forward sweep passes \(m_t\) window to window; if any observation is recorded, a backward sweep passes \(r_t\) the other way and the two combine into exact smoothed posteriors. With no observation the backward pass is skipped and only one window is ever live.
Window junction trees are compiled once, at construction, and reused by every call regardless of horizon or target set; only the requisite subnetwork is recomputed per run. Observations/interventions at slices \(\geq\) nbTimeSlices fall outside the roll and are ignored.
Idempotent. Called lazily by posterior()/posteriors() (last horizon) when out of date. nbTimeSlices becomes the stored horizon.
| InvalidArgument | if nbTimeSlices is 0. |
| FatalError | if the observations have probability 0 under the model. |
Definition at line 954 of file KTBNInference_tpl.h.
References _baseNames_, _belief_(), _determineNode_(), _done_, _horizon_, _interventions_, _interventionSlices_, _k_, _kernelCache_, _ktbn_, _logObservation_, _markRequisite_(), _nbTemporal_, _observations_, _observationSlices_, _posteriors_, _propagate_(), _psiCache_, _psiCached_, _psiScratch_, _requisite_, _snapshot_(), _targeted_mode_, _targets_, _varOfSlot_(), _windowAt_(), _windowPotentials_(), ATEMPORAL, gum::KTBNInference< GUM_SCALAR >::_Window_::bfs, GUM_ERROR, hasObservation(), gum::KTBNInference< GUM_SCALAR >::_Window_::Icur, gum::Set< Key >::insert(), gum::KTBNInference< GUM_SCALAR >::_Window_::Iprev, gum::KTBNInference< GUM_SCALAR >::_Window_::rootC, gum::KTBNInference< GUM_SCALAR >::_Window_::rootD, gum::KTBNInference< GUM_SCALAR >::_Window_::selfClique, gum::KTBNInference< GUM_SCALAR >::_Series_::tensors, and gum::KTBNInference< GUM_SCALAR >::_Series_::vars.
Referenced by _series_(), and logObservationProbability().
| GUM_SCALAR gum::KTBNInference< GUM_SCALAR >::observationProbability | ( | ) |
\(P(\text{obs} \mid do(\cdot))\), i.e. exp of logObservationProbability(). Underflows to 0 on long horizons; prefer the log form.
Definition at line 1210 of file KTBNInference_tpl.h.
References logObservationProbability().
|
delete |
Constructor.
| ktbn | The k-DBN to reason about (referenced, not copied). |
| InvalidArgument | if ktbn is null. |
References KTBNInference().
| const Tensor< GUM_SCALAR > & gum::KTBNInference< GUM_SCALAR >::posterior | ( | std::string_view | base, |
| int | slice ) |
Returns \(P(base[slice] \mid \text{obs}, do(\cdot))\).
Use ATEMPORAL as slice for an atemporal base. Lazily (re)runs makeInference() with the last horizon if out of date. The returned reference is owned by the engine and is invalidated by the next makeInference(); copy it to keep it.
| OperationNotAllowed | if makeInference() has never been run. |
| UndefinedElement | if base is not a target. |
| OutOfBounds | if slice was not computed ( \(\geq\) the horizon). |
Definition at line 1170 of file KTBNInference_tpl.h.
References _horizon_, _isAtemporal_(), _series_(), ATEMPORAL, GUM_ERROR, and gum::KTBNInference< GUM_SCALAR >::_Series_::tensors.
Referenced by posterior().
| const Tensor< GUM_SCALAR > & gum::KTBNInference< GUM_SCALAR >::posterior | ( | std::string_view | node_name | ) |
Same, using an engine name ("X[2]", "C", …).
Definition at line 1188 of file KTBNInference_tpl.h.
References _determineNode_(), and posterior().
| const std::vector< Tensor< GUM_SCALAR > > & gum::KTBNInference< GUM_SCALAR >::posteriors | ( | std::string_view | base | ) |
The whole marginal time-series of a targeted base: tensors[t] is \(P(base[t] \mid \cdot)\) for \(t = 0..T-1\) (a single-element vector, holding the atemporal marginal, for an atemporal base).
Zero-copy: returns a reference to the engine-owned vector, invalidated by the next makeInference(). Lazily (re)runs makeInference() if out of date.
| OperationNotAllowed | if makeInference() has never been run. |
| UndefinedElement | if base is not a target. |
Definition at line 1195 of file KTBNInference_tpl.h.
References _series_(), and gum::KTBNInference< GUM_SCALAR >::_Series_::tensors.
| std::string gum::KTBNInference< GUM_SCALAR >::toString | ( | ) | const |
Definition at line 1234 of file KTBNInference_tpl.h.
References _done_, _interventions_, _k_, _observations_, _targeted_mode_, _targets_, and interfaceSize().
| const JunctionTree & gum::KTBNInference< GUM_SCALAR >::windowJunctionTree | ( | ) | const |
The junction tree of the repeating window – the one compiled from the k-slice template and re-entered at every step from slice \(k-1\) on. Introspection only.
Definition at line 1224 of file KTBNInference_tpl.h.
|
private |
Definition at line 502 of file KTBNInference.h.
Referenced by KTBNInference().
|
private |
name -> index into baseNames
Definition at line 509 of file KTBNInference.h.
Referenced by KTBNInference(), _buildWindows_(), _familySlots_(), _lastConsumerSlice_(), and _markRequisite_().
|
private |
All bases: temporal first (indices 0.._nbTemporal_-1), then atemporal. Window slots index into this.
Definition at line 506 of file KTBNInference.h.
Referenced by KTBNInference(), _applyTemporalObservations_(), _buildWindows_(), _compileWindow_(), _familySlots_(), _fillWindow_(), _interfaceAfter_(), _lastConsumerSlice_(), _markRequisite_(), _varOfSlot_(), and makeInference().
|
private |
Whether the cached posteriors are up to date.
Definition at line 491 of file KTBNInference.h.
Referenced by _series_(), addIntervention(), addIntervention(), addObservation(), addObservation(), addObservations(), addTarget(), clearInterventions(), clearObservation(), clearTargets(), eraseIntervention(), eraseObservation(), eraseTarget(), logObservationProbability(), makeInference(), and toString().
|
private |
Horizon (nbTimeSlices) of the last/next run; 0 <=> makeInference never run.
Definition at line 488 of file KTBNInference.h.
Referenced by _series_(), logObservationProbability(), makeInference(), and posterior().
|
private |
Recorded interventions, keyed by engine name -> forced value.
Definition at line 475 of file KTBNInference.h.
Referenced by _fillWindow_(), addIntervention(), addIntervention(), clearInterventions(), eraseIntervention(), hasIntervention(), makeInference(), and toString().
|
mutableprivate |
Slices carrying a temporal intervention. These need a full rebuild: do(X=x) replaces the node's CPT, which the cached base has already multiplied in, so the base is unusable rather than merely incomplete. Atemporal evidence appears in neither set – it applies at every slice alike and so belongs to the periodic structure.
Definition at line 544 of file KTBNInference.h.
Referenced by _windowPotentials_(), and makeInference().
|
private |
The order k, cached as int for slice arithmetic.
Definition at line 472 of file KTBNInference.h.
Referenced by KTBNInference(), _applyTemporalObservations_(), _buildKernel_(), _buildWindows_(), _compileWindow_(), _familySlots_(), _fillWindow_(), _interfaceAfter_(), _lastConsumerSlice_(), _markRequisite_(), _psiKey_(), _templateVar_(), _varOfSlot_(), _windowAt_(), interfaceSize(), makeInference(), toString(), and windowJunctionTree().
|
mutableprivate |
Memoized transition kernels, keyed by (process, t % k).
buildKernel reads t only through t % k (directly for the child, as (t - lag) % k for each parent – and t >= k with lag <= k-1 there, so the subtraction never goes negative). The kernel is therefore periodic in t with period k: at most k distinct tensors per process, whatever the horizon. Without this, a run rebuilds one per slice per process – and twice per slice once smoothing is on.
Cleared at the top of every makeInference(): cpt() hands out a const reference whose content is mutable, so a caller may edit CPT values between runs. Nothing can change during a run.
Definition at line 565 of file KTBNInference.h.
Referenced by _buildKernel_(), and makeInference().
|
private |
The k-DBN (referenced, not owned).
Definition at line 469 of file KTBNInference.h.
Referenced by KTBNInference(), _applyTemporalObservations_(), _buildKernel_(), _buildWindows_(), _compileWindow_(), _determineNode_(), _familySlots_(), _fillWindow_(), _isAtemporal_(), _isTemporal_(), _lastConsumerSlice_(), _markRequisite_(), _templateVar_(), _varOfSlot_(), ktbn(), and makeInference().
|
private |
log P(observation | do) of the last run.
Definition at line 494 of file KTBNInference.h.
Referenced by logObservationProbability(), and makeInference().
|
private |
maxLag[i]: largest lag at which the transition kernel still consumes temporal base i – how long an occurrence must stay in the interface, which is what makes |I| finite and the window template time-invariant.
Definition at line 514 of file KTBNInference.h.
Referenced by _buildWindows_(), and _lastConsumerSlice_().
|
private |
Definition at line 507 of file KTBNInference.h.
Referenced by KTBNInference(), _applyTemporalObservations_(), _buildWindows_(), _compileWindow_(), _familySlots_(), _fillWindow_(), _interfaceAfter_(), _lastConsumerSlice_(), _markRequisite_(), and makeInference().
|
private |
Recorded observations, keyed by engine name -> likelihood vector (one-hot for a hard observation).
Definition at line 479 of file KTBNInference.h.
Referenced by _applyTemporalObservations_(), _fillWindow_(), _markRequisite_(), addObservation(), addObservation(), addObservations(), clearObservation(), eraseObservation(), hasObservation(), hasObservation(), makeInference(), and toString().
|
mutableprivate |
Slices carrying a temporal observation. Their potentials are the periodic ones times that slice's likelihood, so they are served by copying the cached base and multiplying the evidence in – cheaper than a rebuild, which would redo the unit fill and every CPT product.
Definition at line 537 of file KTBNInference.h.
Referenced by _windowPotentials_(), and makeInference().
|
private |
Cached marginal series of the last run, keyed by base name.
Definition at line 497 of file KTBNInference.h.
Referenced by _series_(), _snapshot_(), and makeInference().
|
mutableprivate |
Memoized clique potentials for the slices that carry no temporal evidence, indexed by psiKey(t). Sized 2k: the k initial slices have their own windows and their own CPTs, the repeating one contributes k phases. O(k) whatever the horizon – unlike keeping one per slice, which would make smoothing grow linearly in T.
Definition at line 530 of file KTBNInference.h.
Referenced by _windowPotentials_(), and makeInference().
|
mutableprivate |
Definition at line 531 of file KTBNInference.h.
Referenced by _windowPotentials_(), and makeInference().
|
mutableprivate |
Potentials of an evidence-carrying slice, rebuilt on each visit.
Definition at line 547 of file KTBNInference.h.
Referenced by _windowPotentials_(), and makeInference().
|
private |
Bases actually folded by the current run: the targets, the observed nodes and all their ancestors. Rebuilt per makeInference() from the current target/observation sets; anything outside is barren and cannot move an answer.
Definition at line 523 of file KTBNInference.h.
Referenced by KTBNInference(), _buildWindows_(), _compileWindow_(), _interfaceAfter_(), _lastConsumerSlice_(), _markRequisite_(), and makeInference().
|
private |
Whether at least one explicit target has been declared.
Definition at line 485 of file KTBNInference.h.
Referenced by _markRequisite_(), addTarget(), clearTargets(), eraseTarget(), isInTargetMode(), isTarget(), makeInference(), and toString().
|
private |
Recorded targets (base names). Empty <=> default-all-targets mode.
Definition at line 482 of file KTBNInference.h.
Referenced by _markRequisite_(), addTarget(), clearTargets(), eraseTarget(), isTarget(), makeInference(), and toString().
|
private |
Temporal / atemporal base names in a deterministic (sorted) order, cached once at construction (the KTBN's own sets are unordered).
Definition at line 501 of file KTBNInference.h.
Referenced by KTBNInference().
|
private |
The compiled windows: index t for t <= k-2 (initial), index k-1 for the repeating window, reused by every slice from k-1 on. Built once.
Definition at line 518 of file KTBNInference.h.
Referenced by _buildWindows_(), _windowAt_(), interfaceSize(), and windowJunctionTree().
|
staticconstexpr |
Convenience alias for the atemporal-slice sentinel.
Definition at line 150 of file KTBNInference.h.
Referenced by _buildKernel_(), _buildWindows_(), _compileWindow_(), _determineNode_(), _encode_(), _familySlots_(), _fillWindow_(), _interfaceAfter_(), _lastConsumerSlice_(), _markRequisite_(), _snapshot_(), _templateVar_(), _validateNode_(), _varOfSlot_(), makeInference(), and posterior().