beanmachine.ppl.world.variable module

class beanmachine.ppl.world.variable.Variable(value: torch.Tensor, distribution: torch.distributions.distribution.Distribution, parents: Set[beanmachine.ppl.model.rv_identifier.RVIdentifier] = <factory>, children: Set[beanmachine.ppl.model.rv_identifier.RVIdentifier] = <factory>)

Bases: object

Primitive used for maintaining metadata of random variables. Usually used in conjunction with World during inference.

children: Set[beanmachine.ppl.model.rv_identifier.RVIdentifier]

Set containing the RVIdentifiers of the children of the random variable

distribution: torch.distributions.distribution.Distribution

Distribution random variable was sampled from

property log_prob: torch.Tensor

Returns The logprob of the value of the value given the distribution.

parents: Set[beanmachine.ppl.model.rv_identifier.RVIdentifier]

Set containing the RVIdentifiers of the parents of the random variable

replace(**changes) beanmachine.ppl.world.variable.Variable

Return a new Variable object with fields replaced by the changes

value: torch.Tensor

Sampled value of random variable