zhusuan.framework.bn¶
- class BayesianNet(observed=None)[source]¶
Bases:
jittor.Module- property cache¶
The dictionary of all named deterministic nodes in this
BayesianNet.- Returns
A dict.
- log_joint(use_cache=False)[source]¶
The default log joint probability of this
BayesianNet. It works by summing over all the conditional log probabilities of stochastic nodes evaluated at their current values (samples or observations).- Returns
A Var.
- property nodes¶
The dictionary of all named stochastic nodes in this
BayesianNet.- Returns
A dict.
- observe(observed)[source]¶
Assign the nodes and values to be observed in this
BayesianNet.- Parameters
observed – A dictionary of (string, Tensor) pairs, which maps from names of stochastic nodes to their observed values.
- property observed¶
The dictionary of all observed nodes in this
BayesianNet.- Returns
A dict.
- sn(*args, **kwargs)[source]¶
Short cut for method
stochastic_node()
- stochastic_node(distribution, name, **kwargs)[source]¶
Add a stochastic node in this
BayesianNetthat follows the distribution assigned by the name parameter.- Parameters
distribution – The distribution which the node follows.
name – The unique name of the node.
**kwargs –
Parameters of the distribution which the node builds with.
- Returns
A instance(sample) of the node.