beanmachine.ppl.compiler.bmg_nodes module

class beanmachine.ppl.compiler.bmg_nodes.AdditionNode(inputs: List[beanmachine.ppl.compiler.bmg_nodes.BMGNode])

Bases: beanmachine.ppl.compiler.bmg_nodes.OperatorNode

This represents an addition of values.

inputs: beanmachine.ppl.compiler.bmg_nodes.InputList
outputs: beanmachine.ppl.utils.item_counter.ItemCounter
class beanmachine.ppl.compiler.bmg_nodes.BMGNode(inputs: List[beanmachine.ppl.compiler.bmg_nodes.BMGNode])

Bases: abc.ABC

The base class for all graph nodes.

inputs: beanmachine.ppl.compiler.bmg_nodes.InputList
property is_leaf: bool
outputs: beanmachine.ppl.utils.item_counter.ItemCounter
class beanmachine.ppl.compiler.bmg_nodes.BernoulliBase(probability: beanmachine.ppl.compiler.bmg_nodes.BMGNode)

Bases: beanmachine.ppl.compiler.bmg_nodes.DistributionNode

inputs: beanmachine.ppl.compiler.bmg_nodes.InputList
outputs: beanmachine.ppl.utils.item_counter.ItemCounter
property probability: beanmachine.ppl.compiler.bmg_nodes.BMGNode
class beanmachine.ppl.compiler.bmg_nodes.BernoulliLogitNode(probability: beanmachine.ppl.compiler.bmg_nodes.BMGNode)

Bases: beanmachine.ppl.compiler.bmg_nodes.BernoulliBase

The Bernoulli distribution is a coin flip; it takes a probability and each sample is either 0.0 or 1.0.

inputs: beanmachine.ppl.compiler.bmg_nodes.InputList
outputs: beanmachine.ppl.utils.item_counter.ItemCounter
class beanmachine.ppl.compiler.bmg_nodes.BernoulliNode(probability: beanmachine.ppl.compiler.bmg_nodes.BMGNode)

Bases: beanmachine.ppl.compiler.bmg_nodes.BernoulliBase

The Bernoulli distribution is a coin flip; it takes a probability and each sample is either 0.0 or 1.0.

inputs: beanmachine.ppl.compiler.bmg_nodes.InputList
outputs: beanmachine.ppl.utils.item_counter.ItemCounter
class beanmachine.ppl.compiler.bmg_nodes.BetaNode(alpha: beanmachine.ppl.compiler.bmg_nodes.BMGNode, beta: beanmachine.ppl.compiler.bmg_nodes.BMGNode)

Bases: beanmachine.ppl.compiler.bmg_nodes.DistributionNode

The beta distribution samples are values between 0.0 and 1.0, and so is useful for creating probabilities.

property alpha: beanmachine.ppl.compiler.bmg_nodes.BMGNode
property beta: beanmachine.ppl.compiler.bmg_nodes.BMGNode
inputs: beanmachine.ppl.compiler.bmg_nodes.InputList
outputs: beanmachine.ppl.utils.item_counter.ItemCounter
class beanmachine.ppl.compiler.bmg_nodes.BinaryOperatorNode(left: beanmachine.ppl.compiler.bmg_nodes.BMGNode, right: beanmachine.ppl.compiler.bmg_nodes.BMGNode)

Bases: beanmachine.ppl.compiler.bmg_nodes.OperatorNode

This is the base class for all binary operators.

inputs: beanmachine.ppl.compiler.bmg_nodes.InputList
property left: beanmachine.ppl.compiler.bmg_nodes.BMGNode
outputs: beanmachine.ppl.utils.item_counter.ItemCounter
property right: beanmachine.ppl.compiler.bmg_nodes.BMGNode
class beanmachine.ppl.compiler.bmg_nodes.BinomialLogitNode(count: beanmachine.ppl.compiler.bmg_nodes.BMGNode, probability: beanmachine.ppl.compiler.bmg_nodes.BMGNode)

Bases: beanmachine.ppl.compiler.bmg_nodes.BinomialNodeBase

The Binomial distribution is the extension of the Bernoulli distribution to multiple flips. The input is the count of flips and the probability of each coming up heads; each sample is the number of heads after “count” flips.

inputs: beanmachine.ppl.compiler.bmg_nodes.InputList
outputs: beanmachine.ppl.utils.item_counter.ItemCounter
class beanmachine.ppl.compiler.bmg_nodes.BinomialNode(count: beanmachine.ppl.compiler.bmg_nodes.BMGNode, probability: beanmachine.ppl.compiler.bmg_nodes.BMGNode, is_logits: bool = False)

Bases: beanmachine.ppl.compiler.bmg_nodes.BinomialNodeBase

The Binomial distribution is the extension of the Bernoulli distribution to multiple flips. The input is the count of flips and the probability of each coming up heads; each sample is the number of heads after “count” flips.

inputs: beanmachine.ppl.compiler.bmg_nodes.InputList
outputs: beanmachine.ppl.utils.item_counter.ItemCounter
class beanmachine.ppl.compiler.bmg_nodes.BinomialNodeBase(count: beanmachine.ppl.compiler.bmg_nodes.BMGNode, probability: beanmachine.ppl.compiler.bmg_nodes.BMGNode)

Bases: beanmachine.ppl.compiler.bmg_nodes.DistributionNode

property count: beanmachine.ppl.compiler.bmg_nodes.BMGNode
inputs: beanmachine.ppl.compiler.bmg_nodes.InputList
outputs: beanmachine.ppl.utils.item_counter.ItemCounter
property probability: beanmachine.ppl.compiler.bmg_nodes.BMGNode
support() Iterable[Any]
class beanmachine.ppl.compiler.bmg_nodes.BitAndNode(left: beanmachine.ppl.compiler.bmg_nodes.BMGNode, right: beanmachine.ppl.compiler.bmg_nodes.BMGNode)

Bases: beanmachine.ppl.compiler.bmg_nodes.BinaryOperatorNode

inputs: beanmachine.ppl.compiler.bmg_nodes.InputList
outputs: beanmachine.ppl.utils.item_counter.ItemCounter
class beanmachine.ppl.compiler.bmg_nodes.BitOrNode(left: beanmachine.ppl.compiler.bmg_nodes.BMGNode, right: beanmachine.ppl.compiler.bmg_nodes.BMGNode)

Bases: beanmachine.ppl.compiler.bmg_nodes.BinaryOperatorNode

inputs: beanmachine.ppl.compiler.bmg_nodes.InputList
outputs: beanmachine.ppl.utils.item_counter.ItemCounter
class beanmachine.ppl.compiler.bmg_nodes.BitXorNode(left: beanmachine.ppl.compiler.bmg_nodes.BMGNode, right: beanmachine.ppl.compiler.bmg_nodes.BMGNode)

Bases: beanmachine.ppl.compiler.bmg_nodes.BinaryOperatorNode

inputs: beanmachine.ppl.compiler.bmg_nodes.InputList
outputs: beanmachine.ppl.utils.item_counter.ItemCounter
class beanmachine.ppl.compiler.bmg_nodes.BooleanNode(value: bool)

Bases: beanmachine.ppl.compiler.bmg_nodes.ConstantNode

A Boolean constant

value: bool
class beanmachine.ppl.compiler.bmg_nodes.CategoricalLogitNode(probability: beanmachine.ppl.compiler.bmg_nodes.BMGNode)

Bases: beanmachine.ppl.compiler.bmg_nodes.CategoricalNodeBase

inputs: beanmachine.ppl.compiler.bmg_nodes.InputList
outputs: beanmachine.ppl.utils.item_counter.ItemCounter
class beanmachine.ppl.compiler.bmg_nodes.CategoricalNode(probability: beanmachine.ppl.compiler.bmg_nodes.BMGNode)

Bases: beanmachine.ppl.compiler.bmg_nodes.CategoricalNodeBase

inputs: beanmachine.ppl.compiler.bmg_nodes.InputList
outputs: beanmachine.ppl.utils.item_counter.ItemCounter
class beanmachine.ppl.compiler.bmg_nodes.CategoricalNodeBase(probability: beanmachine.ppl.compiler.bmg_nodes.BMGNode)

Bases: beanmachine.ppl.compiler.bmg_nodes.DistributionNode

The categorical distribution is the extension of the Bernoulli distribution to multiple outcomes; rather than flipping an unfair coin, this is rolling an unfair n-sided die.

The input is the probability of each of n possible outcomes, and each sample is drawn from 0, 1, 2, … n-1.

inputs: beanmachine.ppl.compiler.bmg_nodes.InputList
outputs: beanmachine.ppl.utils.item_counter.ItemCounter
property probability: beanmachine.ppl.compiler.bmg_nodes.BMGNode
class beanmachine.ppl.compiler.bmg_nodes.Chi2Node(df: beanmachine.ppl.compiler.bmg_nodes.BMGNode)

Bases: beanmachine.ppl.compiler.bmg_nodes.DistributionNode

The chi2 distribution is a distribution of positive real numbers; it is a special case of the gamma distribution.

property df: beanmachine.ppl.compiler.bmg_nodes.BMGNode
inputs: beanmachine.ppl.compiler.bmg_nodes.InputList
outputs: beanmachine.ppl.utils.item_counter.ItemCounter
class beanmachine.ppl.compiler.bmg_nodes.ChoiceNode(condition: beanmachine.ppl.compiler.bmg_nodes.BMGNode, items: List[beanmachine.ppl.compiler.bmg_nodes.BMGNode])

Bases: beanmachine.ppl.compiler.bmg_nodes.OperatorNode

This class represents a stochastic choice between n options, where the condition is a natural.

inputs: beanmachine.ppl.compiler.bmg_nodes.InputList
outputs: beanmachine.ppl.utils.item_counter.ItemCounter
class beanmachine.ppl.compiler.bmg_nodes.CholeskyNode(operand: beanmachine.ppl.compiler.bmg_nodes.BMGNode)

Bases: beanmachine.ppl.compiler.bmg_nodes.UnaryOperatorNode

This represents an Cholesky operation; it is generated when a model contains calls to Tensor.cholesky.

inputs: beanmachine.ppl.compiler.bmg_nodes.InputList
outputs: beanmachine.ppl.utils.item_counter.ItemCounter
class beanmachine.ppl.compiler.bmg_nodes.ColumnIndexNode(left: beanmachine.ppl.compiler.bmg_nodes.BMGNode, right: beanmachine.ppl.compiler.bmg_nodes.BMGNode)

Bases: beanmachine.ppl.compiler.bmg_nodes.BinaryOperatorNode

inputs: beanmachine.ppl.compiler.bmg_nodes.InputList
outputs: beanmachine.ppl.utils.item_counter.ItemCounter
class beanmachine.ppl.compiler.bmg_nodes.ComparisonNode(left: beanmachine.ppl.compiler.bmg_nodes.BMGNode, right: beanmachine.ppl.compiler.bmg_nodes.BMGNode)

Bases: beanmachine.ppl.compiler.bmg_nodes.BinaryOperatorNode

This is the base class for all comparison operators.

inputs: beanmachine.ppl.compiler.bmg_nodes.InputList
outputs: beanmachine.ppl.utils.item_counter.ItemCounter
class beanmachine.ppl.compiler.bmg_nodes.ComplementNode(operand: beanmachine.ppl.compiler.bmg_nodes.BMGNode)

Bases: beanmachine.ppl.compiler.bmg_nodes.UnaryOperatorNode

This represents a complement of a Boolean or probability value.

inputs: beanmachine.ppl.compiler.bmg_nodes.InputList
outputs: beanmachine.ppl.utils.item_counter.ItemCounter
class beanmachine.ppl.compiler.bmg_nodes.ConstantBooleanMatrixNode(value: torch.Tensor)

Bases: beanmachine.ppl.compiler.bmg_nodes.ConstantTensorNode

value: torch.Tensor
class beanmachine.ppl.compiler.bmg_nodes.ConstantNaturalMatrixNode(value: torch.Tensor)

Bases: beanmachine.ppl.compiler.bmg_nodes.ConstantTensorNode

value: torch.Tensor
class beanmachine.ppl.compiler.bmg_nodes.ConstantNegativeRealMatrixNode(value: torch.Tensor)

Bases: beanmachine.ppl.compiler.bmg_nodes.ConstantTensorNode

value: torch.Tensor
class beanmachine.ppl.compiler.bmg_nodes.ConstantNode

Bases: beanmachine.ppl.compiler.bmg_nodes.BMGNode

This is the base type for all nodes representing constants. Note that every constant node has an associated type in the BMG type system; nodes that represent the “real” 1.0, the “positive real” 1.0, the “probability” 1.0 and the “natural” 1 are all different nodes and are NOT deduplicated.

value: Any
class beanmachine.ppl.compiler.bmg_nodes.ConstantPositiveRealMatrixNode(value: torch.Tensor)

Bases: beanmachine.ppl.compiler.bmg_nodes.ConstantTensorNode

value: torch.Tensor
class beanmachine.ppl.compiler.bmg_nodes.ConstantProbabilityMatrixNode(value: torch.Tensor)

Bases: beanmachine.ppl.compiler.bmg_nodes.ConstantTensorNode

value: torch.Tensor
class beanmachine.ppl.compiler.bmg_nodes.ConstantRealMatrixNode(value: torch.Tensor)

Bases: beanmachine.ppl.compiler.bmg_nodes.ConstantTensorNode

value: torch.Tensor
class beanmachine.ppl.compiler.bmg_nodes.ConstantSimplexMatrixNode(value: torch.Tensor)

Bases: beanmachine.ppl.compiler.bmg_nodes.ConstantTensorNode

value: torch.Tensor
class beanmachine.ppl.compiler.bmg_nodes.ConstantTensorNode(value: torch.Tensor)

Bases: beanmachine.ppl.compiler.bmg_nodes.ConstantNode

A tensor constant

value: torch.Tensor
class beanmachine.ppl.compiler.bmg_nodes.DirichletNode(concentration: beanmachine.ppl.compiler.bmg_nodes.BMGNode)

Bases: beanmachine.ppl.compiler.bmg_nodes.DistributionNode

The Dirichlet distribution generates simplexs – vectors whose members are probabilities that add to 1.0, and so it is useful for generating inputs to the categorical distribution.

property concentration: beanmachine.ppl.compiler.bmg_nodes.BMGNode
inputs: beanmachine.ppl.compiler.bmg_nodes.InputList
outputs: beanmachine.ppl.utils.item_counter.ItemCounter
class beanmachine.ppl.compiler.bmg_nodes.DistributionNode(inputs: List[beanmachine.ppl.compiler.bmg_nodes.BMGNode])

Bases: beanmachine.ppl.compiler.bmg_nodes.BMGNode

This is the base class for all nodes that represent probability distributions.

inputs: beanmachine.ppl.compiler.bmg_nodes.InputList
outputs: beanmachine.ppl.utils.item_counter.ItemCounter
class beanmachine.ppl.compiler.bmg_nodes.DivisionNode(left: beanmachine.ppl.compiler.bmg_nodes.BMGNode, right: beanmachine.ppl.compiler.bmg_nodes.BMGNode)

Bases: beanmachine.ppl.compiler.bmg_nodes.BinaryOperatorNode

This represents a division.

inputs: beanmachine.ppl.compiler.bmg_nodes.InputList
outputs: beanmachine.ppl.utils.item_counter.ItemCounter
class beanmachine.ppl.compiler.bmg_nodes.EqualNode(left: beanmachine.ppl.compiler.bmg_nodes.BMGNode, right: beanmachine.ppl.compiler.bmg_nodes.BMGNode)

Bases: beanmachine.ppl.compiler.bmg_nodes.ComparisonNode

inputs: beanmachine.ppl.compiler.bmg_nodes.InputList
outputs: beanmachine.ppl.utils.item_counter.ItemCounter
class beanmachine.ppl.compiler.bmg_nodes.Exp2Node(operand: beanmachine.ppl.compiler.bmg_nodes.BMGNode)

Bases: beanmachine.ppl.compiler.bmg_nodes.UnaryOperatorNode

inputs: beanmachine.ppl.compiler.bmg_nodes.InputList
outputs: beanmachine.ppl.utils.item_counter.ItemCounter
class beanmachine.ppl.compiler.bmg_nodes.ExpM1Node(operand: beanmachine.ppl.compiler.bmg_nodes.BMGNode)

Bases: beanmachine.ppl.compiler.bmg_nodes.UnaryOperatorNode

This represents the operation exp(x) - 1; it is generated when a model contains calls to Tensor.expm1.

inputs: beanmachine.ppl.compiler.bmg_nodes.InputList
outputs: beanmachine.ppl.utils.item_counter.ItemCounter
class beanmachine.ppl.compiler.bmg_nodes.ExpNode(operand: beanmachine.ppl.compiler.bmg_nodes.BMGNode)

Bases: beanmachine.ppl.compiler.bmg_nodes.UnaryOperatorNode

This represents an exponentiation operation; it is generated when a model contains calls to Tensor.exp or math.exp.

inputs: beanmachine.ppl.compiler.bmg_nodes.InputList
outputs: beanmachine.ppl.utils.item_counter.ItemCounter
class beanmachine.ppl.compiler.bmg_nodes.ExpProductFactorNode(inputs: List[beanmachine.ppl.compiler.bmg_nodes.BMGNode])

Bases: beanmachine.ppl.compiler.bmg_nodes.FactorNode

inputs: beanmachine.ppl.compiler.bmg_nodes.InputList
outputs: beanmachine.ppl.utils.item_counter.ItemCounter
class beanmachine.ppl.compiler.bmg_nodes.FactorNode(inputs: List[beanmachine.ppl.compiler.bmg_nodes.BMGNode])

Bases: beanmachine.ppl.compiler.bmg_nodes.BMGNode

This is the base class for all factors. The inputs are the operands of each factor.

inputs: beanmachine.ppl.compiler.bmg_nodes.InputList
outputs: beanmachine.ppl.utils.item_counter.ItemCounter
class beanmachine.ppl.compiler.bmg_nodes.FlatNode

Bases: beanmachine.ppl.compiler.bmg_nodes.DistributionNode

The Flat distribution the standard uniform distribution from 0.0 to 1.0.

inputs: beanmachine.ppl.compiler.bmg_nodes.InputList
outputs: beanmachine.ppl.utils.item_counter.ItemCounter
class beanmachine.ppl.compiler.bmg_nodes.FloorDivNode(left: beanmachine.ppl.compiler.bmg_nodes.BMGNode, right: beanmachine.ppl.compiler.bmg_nodes.BMGNode)

Bases: beanmachine.ppl.compiler.bmg_nodes.BinaryOperatorNode

inputs: beanmachine.ppl.compiler.bmg_nodes.InputList
outputs: beanmachine.ppl.utils.item_counter.ItemCounter
class beanmachine.ppl.compiler.bmg_nodes.GammaNode(concentration: beanmachine.ppl.compiler.bmg_nodes.BMGNode, rate: beanmachine.ppl.compiler.bmg_nodes.BMGNode)

Bases: beanmachine.ppl.compiler.bmg_nodes.DistributionNode

The gamma distribution is a distribution of positive real numbers characterized by positive real concentration and rate parameters.

property concentration: beanmachine.ppl.compiler.bmg_nodes.BMGNode
inputs: beanmachine.ppl.compiler.bmg_nodes.InputList
outputs: beanmachine.ppl.utils.item_counter.ItemCounter
property rate: beanmachine.ppl.compiler.bmg_nodes.BMGNode
class beanmachine.ppl.compiler.bmg_nodes.GreaterThanEqualNode(left: beanmachine.ppl.compiler.bmg_nodes.BMGNode, right: beanmachine.ppl.compiler.bmg_nodes.BMGNode)

Bases: beanmachine.ppl.compiler.bmg_nodes.ComparisonNode

inputs: beanmachine.ppl.compiler.bmg_nodes.InputList
outputs: beanmachine.ppl.utils.item_counter.ItemCounter
class beanmachine.ppl.compiler.bmg_nodes.GreaterThanNode(left: beanmachine.ppl.compiler.bmg_nodes.BMGNode, right: beanmachine.ppl.compiler.bmg_nodes.BMGNode)

Bases: beanmachine.ppl.compiler.bmg_nodes.ComparisonNode

inputs: beanmachine.ppl.compiler.bmg_nodes.InputList
outputs: beanmachine.ppl.utils.item_counter.ItemCounter
class beanmachine.ppl.compiler.bmg_nodes.HalfCauchyNode(scale: beanmachine.ppl.compiler.bmg_nodes.BMGNode)

Bases: beanmachine.ppl.compiler.bmg_nodes.DistributionNode

The Cauchy distribution is a bell curve with zero mean and a heavier tail than the normal distribution; it is useful for generating samples that are not as clustered around the mean as a normal.

The half Cauchy distribution is just the distribution you get when you take the absolute value of the samples from a Cauchy distribution. The input is a positive scale factor and a sample is a positive real number.

inputs: beanmachine.ppl.compiler.bmg_nodes.InputList
outputs: beanmachine.ppl.utils.item_counter.ItemCounter
property scale: beanmachine.ppl.compiler.bmg_nodes.BMGNode
class beanmachine.ppl.compiler.bmg_nodes.HalfNormalNode(sigma: beanmachine.ppl.compiler.bmg_nodes.BMGNode)

Bases: beanmachine.ppl.compiler.bmg_nodes.DistributionNode

The half-normal distribution is a half bell curve with a given standard deviation. Mean (for the underlying normal) is taken to be zero.

inputs: beanmachine.ppl.compiler.bmg_nodes.InputList
outputs: beanmachine.ppl.utils.item_counter.ItemCounter
property sigma: beanmachine.ppl.compiler.bmg_nodes.BMGNode
class beanmachine.ppl.compiler.bmg_nodes.IfThenElseNode(condition: beanmachine.ppl.compiler.bmg_nodes.BMGNode, consequence: beanmachine.ppl.compiler.bmg_nodes.BMGNode, alternative: beanmachine.ppl.compiler.bmg_nodes.BMGNode)

Bases: beanmachine.ppl.compiler.bmg_nodes.OperatorNode

This class represents a stochastic choice between two options, where the condition is a Boolean.

property alternative: beanmachine.ppl.compiler.bmg_nodes.BMGNode
property condition: beanmachine.ppl.compiler.bmg_nodes.BMGNode
property consequence: beanmachine.ppl.compiler.bmg_nodes.BMGNode
inputs: beanmachine.ppl.compiler.bmg_nodes.InputList
outputs: beanmachine.ppl.utils.item_counter.ItemCounter
class beanmachine.ppl.compiler.bmg_nodes.InNode(left: beanmachine.ppl.compiler.bmg_nodes.BMGNode, right: beanmachine.ppl.compiler.bmg_nodes.BMGNode)

Bases: beanmachine.ppl.compiler.bmg_nodes.ComparisonNode

inputs: beanmachine.ppl.compiler.bmg_nodes.InputList
outputs: beanmachine.ppl.utils.item_counter.ItemCounter
class beanmachine.ppl.compiler.bmg_nodes.IndexNode(left: beanmachine.ppl.compiler.bmg_nodes.BMGNode, right: beanmachine.ppl.compiler.bmg_nodes.BMGNode)

Bases: beanmachine.ppl.compiler.bmg_nodes.BinaryOperatorNode

inputs: beanmachine.ppl.compiler.bmg_nodes.InputList
outputs: beanmachine.ppl.utils.item_counter.ItemCounter
class beanmachine.ppl.compiler.bmg_nodes.InputList(node: beanmachine.ppl.compiler.bmg_nodes.BMGNode, inputs: List[beanmachine.ppl.compiler.bmg_nodes.BMGNode])

Bases: object

inputs: List[beanmachine.ppl.compiler.bmg_nodes.BMGNode]
node: beanmachine.ppl.compiler.bmg_nodes.BMGNode
class beanmachine.ppl.compiler.bmg_nodes.InvertNode(operand: beanmachine.ppl.compiler.bmg_nodes.BMGNode)

Bases: beanmachine.ppl.compiler.bmg_nodes.UnaryOperatorNode

This represents a bit inversion (~).

inputs: beanmachine.ppl.compiler.bmg_nodes.InputList
outputs: beanmachine.ppl.utils.item_counter.ItemCounter
class beanmachine.ppl.compiler.bmg_nodes.IsNode(left: beanmachine.ppl.compiler.bmg_nodes.BMGNode, right: beanmachine.ppl.compiler.bmg_nodes.BMGNode)

Bases: beanmachine.ppl.compiler.bmg_nodes.ComparisonNode

inputs: beanmachine.ppl.compiler.bmg_nodes.InputList
outputs: beanmachine.ppl.utils.item_counter.ItemCounter
class beanmachine.ppl.compiler.bmg_nodes.IsNotNode(left: beanmachine.ppl.compiler.bmg_nodes.BMGNode, right: beanmachine.ppl.compiler.bmg_nodes.BMGNode)

Bases: beanmachine.ppl.compiler.bmg_nodes.ComparisonNode

inputs: beanmachine.ppl.compiler.bmg_nodes.InputList
outputs: beanmachine.ppl.utils.item_counter.ItemCounter
class beanmachine.ppl.compiler.bmg_nodes.ItemNode(operand: beanmachine.ppl.compiler.bmg_nodes.BMGNode)

Bases: beanmachine.ppl.compiler.bmg_nodes.OperatorNode

Represents torch.Tensor.item() conversion from tensor to scalar.

inputs: beanmachine.ppl.compiler.bmg_nodes.InputList
outputs: beanmachine.ppl.utils.item_counter.ItemCounter
class beanmachine.ppl.compiler.bmg_nodes.LShiftNode(left: beanmachine.ppl.compiler.bmg_nodes.BMGNode, right: beanmachine.ppl.compiler.bmg_nodes.BMGNode)

Bases: beanmachine.ppl.compiler.bmg_nodes.BinaryOperatorNode

inputs: beanmachine.ppl.compiler.bmg_nodes.InputList
outputs: beanmachine.ppl.utils.item_counter.ItemCounter
class beanmachine.ppl.compiler.bmg_nodes.LessThanEqualNode(left: beanmachine.ppl.compiler.bmg_nodes.BMGNode, right: beanmachine.ppl.compiler.bmg_nodes.BMGNode)

Bases: beanmachine.ppl.compiler.bmg_nodes.ComparisonNode

inputs: beanmachine.ppl.compiler.bmg_nodes.InputList
outputs: beanmachine.ppl.utils.item_counter.ItemCounter
class beanmachine.ppl.compiler.bmg_nodes.LessThanNode(left: beanmachine.ppl.compiler.bmg_nodes.BMGNode, right: beanmachine.ppl.compiler.bmg_nodes.BMGNode)

Bases: beanmachine.ppl.compiler.bmg_nodes.ComparisonNode

inputs: beanmachine.ppl.compiler.bmg_nodes.InputList
outputs: beanmachine.ppl.utils.item_counter.ItemCounter
class beanmachine.ppl.compiler.bmg_nodes.Log10Node(operand: beanmachine.ppl.compiler.bmg_nodes.BMGNode)

Bases: beanmachine.ppl.compiler.bmg_nodes.UnaryOperatorNode

inputs: beanmachine.ppl.compiler.bmg_nodes.InputList
outputs: beanmachine.ppl.utils.item_counter.ItemCounter
class beanmachine.ppl.compiler.bmg_nodes.Log1mexpNode(operand: beanmachine.ppl.compiler.bmg_nodes.BMGNode)

Bases: beanmachine.ppl.compiler.bmg_nodes.UnaryOperatorNode

This represents a log1mexp operation; it is generated as an optimization when a graph contains x -> exp -> complement -> log

inputs: beanmachine.ppl.compiler.bmg_nodes.InputList
outputs: beanmachine.ppl.utils.item_counter.ItemCounter
class beanmachine.ppl.compiler.bmg_nodes.Log1pNode(operand: beanmachine.ppl.compiler.bmg_nodes.BMGNode)

Bases: beanmachine.ppl.compiler.bmg_nodes.UnaryOperatorNode

inputs: beanmachine.ppl.compiler.bmg_nodes.InputList
outputs: beanmachine.ppl.utils.item_counter.ItemCounter
class beanmachine.ppl.compiler.bmg_nodes.Log2Node(operand: beanmachine.ppl.compiler.bmg_nodes.BMGNode)

Bases: beanmachine.ppl.compiler.bmg_nodes.UnaryOperatorNode

inputs: beanmachine.ppl.compiler.bmg_nodes.InputList
outputs: beanmachine.ppl.utils.item_counter.ItemCounter
class beanmachine.ppl.compiler.bmg_nodes.LogAddExpNode(left: beanmachine.ppl.compiler.bmg_nodes.BMGNode, right: beanmachine.ppl.compiler.bmg_nodes.BMGNode)

Bases: beanmachine.ppl.compiler.bmg_nodes.BinaryOperatorNode

This class represents the LogAddExp operation: for values v_1, v_2 we compute log(exp(v_1) + exp(v_2))

inputs: beanmachine.ppl.compiler.bmg_nodes.InputList
outputs: beanmachine.ppl.utils.item_counter.ItemCounter
class beanmachine.ppl.compiler.bmg_nodes.LogNode(operand: beanmachine.ppl.compiler.bmg_nodes.BMGNode)

Bases: beanmachine.ppl.compiler.bmg_nodes.UnaryOperatorNode

This represents a log operation; it is generated when a model contains calls to Tensor.log or math.log.

inputs: beanmachine.ppl.compiler.bmg_nodes.InputList
outputs: beanmachine.ppl.utils.item_counter.ItemCounter
class beanmachine.ppl.compiler.bmg_nodes.LogSumExpNode(inputs: List[beanmachine.ppl.compiler.bmg_nodes.BMGNode])

Bases: beanmachine.ppl.compiler.bmg_nodes.OperatorNode

This class represents the LogSumExp operation: for values v_1, …, v_n we compute log(exp(v_1) + … + exp(v_n))

inputs: beanmachine.ppl.compiler.bmg_nodes.InputList
outputs: beanmachine.ppl.utils.item_counter.ItemCounter
class beanmachine.ppl.compiler.bmg_nodes.LogSumExpTorchNode(operand: beanmachine.ppl.compiler.bmg_nodes.BMGNode, dim: beanmachine.ppl.compiler.bmg_nodes.BMGNode, keepdim: beanmachine.ppl.compiler.bmg_nodes.BMGNode)

Bases: beanmachine.ppl.compiler.bmg_nodes.OperatorNode

inputs: beanmachine.ppl.compiler.bmg_nodes.InputList
outputs: beanmachine.ppl.utils.item_counter.ItemCounter
class beanmachine.ppl.compiler.bmg_nodes.LogSumExpVectorNode(operand: beanmachine.ppl.compiler.bmg_nodes.BMGNode)

Bases: beanmachine.ppl.compiler.bmg_nodes.UnaryOperatorNode

inputs: beanmachine.ppl.compiler.bmg_nodes.InputList
outputs: beanmachine.ppl.utils.item_counter.ItemCounter
class beanmachine.ppl.compiler.bmg_nodes.LogisticNode(operand: beanmachine.ppl.compiler.bmg_nodes.BMGNode)

Bases: beanmachine.ppl.compiler.bmg_nodes.UnaryOperatorNode

This represents the operation 1/(1+exp(x)); it is generated when a model contains calls to Tensor.sigmoid.

inputs: beanmachine.ppl.compiler.bmg_nodes.InputList
outputs: beanmachine.ppl.utils.item_counter.ItemCounter
class beanmachine.ppl.compiler.bmg_nodes.MatrixMultiplicationNode(left: beanmachine.ppl.compiler.bmg_nodes.BMGNode, right: beanmachine.ppl.compiler.bmg_nodes.BMGNode)

Bases: beanmachine.ppl.compiler.bmg_nodes.BinaryOperatorNode

This represents a matrix multiplication.

inputs: beanmachine.ppl.compiler.bmg_nodes.InputList
outputs: beanmachine.ppl.utils.item_counter.ItemCounter
class beanmachine.ppl.compiler.bmg_nodes.MatrixScaleNode(left: beanmachine.ppl.compiler.bmg_nodes.BMGNode, right: beanmachine.ppl.compiler.bmg_nodes.BMGNode)

Bases: beanmachine.ppl.compiler.bmg_nodes.BinaryOperatorNode

This represents a matrix scaling.

inputs: beanmachine.ppl.compiler.bmg_nodes.InputList
outputs: beanmachine.ppl.utils.item_counter.ItemCounter
class beanmachine.ppl.compiler.bmg_nodes.ModNode(left: beanmachine.ppl.compiler.bmg_nodes.BMGNode, right: beanmachine.ppl.compiler.bmg_nodes.BMGNode)

Bases: beanmachine.ppl.compiler.bmg_nodes.BinaryOperatorNode

inputs: beanmachine.ppl.compiler.bmg_nodes.InputList
outputs: beanmachine.ppl.utils.item_counter.ItemCounter
class beanmachine.ppl.compiler.bmg_nodes.MultiplicationNode(inputs: List[beanmachine.ppl.compiler.bmg_nodes.BMGNode])

Bases: beanmachine.ppl.compiler.bmg_nodes.OperatorNode

This represents multiplication of values.

inputs: beanmachine.ppl.compiler.bmg_nodes.InputList
outputs: beanmachine.ppl.utils.item_counter.ItemCounter
class beanmachine.ppl.compiler.bmg_nodes.NaturalNode(value: int)

Bases: beanmachine.ppl.compiler.bmg_nodes.ConstantNode

An integer constant restricted to non-negative values

value: int
class beanmachine.ppl.compiler.bmg_nodes.NegateNode(operand: beanmachine.ppl.compiler.bmg_nodes.BMGNode)

Bases: beanmachine.ppl.compiler.bmg_nodes.UnaryOperatorNode

This represents a unary minus.

inputs: beanmachine.ppl.compiler.bmg_nodes.InputList
outputs: beanmachine.ppl.utils.item_counter.ItemCounter
class beanmachine.ppl.compiler.bmg_nodes.NegativeRealNode(value: float)

Bases: beanmachine.ppl.compiler.bmg_nodes.ConstantNode

A real constant restricted to non-positive values

value: float
class beanmachine.ppl.compiler.bmg_nodes.NormalNode(mu: beanmachine.ppl.compiler.bmg_nodes.BMGNode, sigma: beanmachine.ppl.compiler.bmg_nodes.BMGNode)

Bases: beanmachine.ppl.compiler.bmg_nodes.DistributionNode

The normal (or “Gaussian”) distribution is a bell curve with a given mean and standard deviation.

inputs: beanmachine.ppl.compiler.bmg_nodes.InputList
property mu: beanmachine.ppl.compiler.bmg_nodes.BMGNode
outputs: beanmachine.ppl.utils.item_counter.ItemCounter
property sigma: beanmachine.ppl.compiler.bmg_nodes.BMGNode
class beanmachine.ppl.compiler.bmg_nodes.NotEqualNode(left: beanmachine.ppl.compiler.bmg_nodes.BMGNode, right: beanmachine.ppl.compiler.bmg_nodes.BMGNode)

Bases: beanmachine.ppl.compiler.bmg_nodes.ComparisonNode

inputs: beanmachine.ppl.compiler.bmg_nodes.InputList
outputs: beanmachine.ppl.utils.item_counter.ItemCounter
class beanmachine.ppl.compiler.bmg_nodes.NotInNode(left: beanmachine.ppl.compiler.bmg_nodes.BMGNode, right: beanmachine.ppl.compiler.bmg_nodes.BMGNode)

Bases: beanmachine.ppl.compiler.bmg_nodes.ComparisonNode

inputs: beanmachine.ppl.compiler.bmg_nodes.InputList
outputs: beanmachine.ppl.utils.item_counter.ItemCounter
class beanmachine.ppl.compiler.bmg_nodes.NotNode(operand: beanmachine.ppl.compiler.bmg_nodes.BMGNode)

Bases: beanmachine.ppl.compiler.bmg_nodes.UnaryOperatorNode

This represents a logical not that appears in the Python model.

inputs: beanmachine.ppl.compiler.bmg_nodes.InputList
outputs: beanmachine.ppl.utils.item_counter.ItemCounter
class beanmachine.ppl.compiler.bmg_nodes.Observation(observed: beanmachine.ppl.compiler.bmg_nodes.BMGNode, value: Any)

Bases: beanmachine.ppl.compiler.bmg_nodes.BMGNode

This represents an observed value of a sample. For example we might have a prior that a mint produces a coin that is uniformly unfair. We could then observe a flip of the coin and if heads, that is small but not zero evidence that the coin is unfair in the heads direction. Given that observation, our belief in the true unfairness of the coin should no loger be uniform.

property observed: beanmachine.ppl.compiler.bmg_nodes.BMGNode
value: Any
class beanmachine.ppl.compiler.bmg_nodes.OperatorNode(inputs: List[beanmachine.ppl.compiler.bmg_nodes.BMGNode])

Bases: beanmachine.ppl.compiler.bmg_nodes.BMGNode

This is the base class for all operators. The inputs are the operands of each operator.

inputs: beanmachine.ppl.compiler.bmg_nodes.InputList
outputs: beanmachine.ppl.utils.item_counter.ItemCounter
class beanmachine.ppl.compiler.bmg_nodes.PhiNode(operand: beanmachine.ppl.compiler.bmg_nodes.BMGNode)

Bases: beanmachine.ppl.compiler.bmg_nodes.UnaryOperatorNode

This represents a phi operation; that is, the cumulative distribution function of the standard normal.

inputs: beanmachine.ppl.compiler.bmg_nodes.InputList
outputs: beanmachine.ppl.utils.item_counter.ItemCounter
class beanmachine.ppl.compiler.bmg_nodes.PoissonNode(rate: beanmachine.ppl.compiler.bmg_nodes.BMGNode)

Bases: beanmachine.ppl.compiler.bmg_nodes.DistributionNode

The Poisson distribution samples are non-negative integer valued.

inputs: beanmachine.ppl.compiler.bmg_nodes.InputList
outputs: beanmachine.ppl.utils.item_counter.ItemCounter
property rate: beanmachine.ppl.compiler.bmg_nodes.BMGNode
class beanmachine.ppl.compiler.bmg_nodes.PositiveRealNode(value: float)

Bases: beanmachine.ppl.compiler.bmg_nodes.ConstantNode

A real constant restricted to non-negative values

value: float
class beanmachine.ppl.compiler.bmg_nodes.PowerNode(left: beanmachine.ppl.compiler.bmg_nodes.BMGNode, right: beanmachine.ppl.compiler.bmg_nodes.BMGNode)

Bases: beanmachine.ppl.compiler.bmg_nodes.BinaryOperatorNode

This represents an x-to-the-y operation.

inputs: beanmachine.ppl.compiler.bmg_nodes.InputList
outputs: beanmachine.ppl.utils.item_counter.ItemCounter
class beanmachine.ppl.compiler.bmg_nodes.ProbabilityNode(value: float)

Bases: beanmachine.ppl.compiler.bmg_nodes.ConstantNode

A real constant restricted to values from 0.0 to 1.0

value: float
class beanmachine.ppl.compiler.bmg_nodes.Query(operator: beanmachine.ppl.compiler.bmg_nodes.BMGNode)

Bases: beanmachine.ppl.compiler.bmg_nodes.BMGNode

A query is a marker on a node in the graph that indicates to the inference engine that the user is interested in getting a distribution of values of that node.

inputs: beanmachine.ppl.compiler.bmg_nodes.InputList
property operator: beanmachine.ppl.compiler.bmg_nodes.BMGNode
outputs: beanmachine.ppl.utils.item_counter.ItemCounter
class beanmachine.ppl.compiler.bmg_nodes.RShiftNode(left: beanmachine.ppl.compiler.bmg_nodes.BMGNode, right: beanmachine.ppl.compiler.bmg_nodes.BMGNode)

Bases: beanmachine.ppl.compiler.bmg_nodes.BinaryOperatorNode

inputs: beanmachine.ppl.compiler.bmg_nodes.InputList
outputs: beanmachine.ppl.utils.item_counter.ItemCounter
class beanmachine.ppl.compiler.bmg_nodes.RealNode(value: float)

Bases: beanmachine.ppl.compiler.bmg_nodes.ConstantNode

An unrestricted real constant

value: float
class beanmachine.ppl.compiler.bmg_nodes.SampleNode(operand: beanmachine.ppl.compiler.bmg_nodes.DistributionNode)

Bases: beanmachine.ppl.compiler.bmg_nodes.UnaryOperatorNode

This represents a single unique sample from a distribution; if a graph has two sample nodes both taking input from the same distribution, each sample is logically distinct. But if a graph has two nodes that both input from the same sample node, we must treat those two uses of the sample as though they had identical values.

inputs: beanmachine.ppl.compiler.bmg_nodes.InputList
property operand: beanmachine.ppl.compiler.bmg_nodes.DistributionNode
outputs: beanmachine.ppl.utils.item_counter.ItemCounter
class beanmachine.ppl.compiler.bmg_nodes.SquareRootNode(operand: beanmachine.ppl.compiler.bmg_nodes.BMGNode)

Bases: beanmachine.ppl.compiler.bmg_nodes.UnaryOperatorNode

inputs: beanmachine.ppl.compiler.bmg_nodes.InputList
outputs: beanmachine.ppl.utils.item_counter.ItemCounter
class beanmachine.ppl.compiler.bmg_nodes.StudentTNode(df: beanmachine.ppl.compiler.bmg_nodes.BMGNode, loc: beanmachine.ppl.compiler.bmg_nodes.BMGNode, scale: beanmachine.ppl.compiler.bmg_nodes.BMGNode)

Bases: beanmachine.ppl.compiler.bmg_nodes.DistributionNode

The Student T distribution is a bell curve with zero mean and a heavier tail than the normal distribution. It is useful in statistical analysis because a common situation is to have observations of a normal process but to not know the true mean. Samples from the T distribution can be used to represent the difference between an observed mean and the true mean.

property df: beanmachine.ppl.compiler.bmg_nodes.BMGNode
inputs: beanmachine.ppl.compiler.bmg_nodes.InputList
property loc: beanmachine.ppl.compiler.bmg_nodes.BMGNode
outputs: beanmachine.ppl.utils.item_counter.ItemCounter
property scale: beanmachine.ppl.compiler.bmg_nodes.BMGNode
class beanmachine.ppl.compiler.bmg_nodes.SumNode(operand: beanmachine.ppl.compiler.bmg_nodes.BMGNode)

Bases: beanmachine.ppl.compiler.bmg_nodes.UnaryOperatorNode

inputs: beanmachine.ppl.compiler.bmg_nodes.InputList
outputs: beanmachine.ppl.utils.item_counter.ItemCounter
class beanmachine.ppl.compiler.bmg_nodes.SwitchNode(inputs: List[beanmachine.ppl.compiler.bmg_nodes.BMGNode])

Bases: beanmachine.ppl.compiler.bmg_nodes.BMGNode

This class represents a point in a program where there are multiple control flows based on the value of a stochastic node.

inputs: beanmachine.ppl.compiler.bmg_nodes.InputList
outputs: beanmachine.ppl.utils.item_counter.ItemCounter
class beanmachine.ppl.compiler.bmg_nodes.TensorNode(items: List[beanmachine.ppl.compiler.bmg_nodes.BMGNode], size: torch.Size)

Bases: beanmachine.ppl.compiler.bmg_nodes.BMGNode

A tensor whose elements are graph nodes.

class beanmachine.ppl.compiler.bmg_nodes.ToIntNode(operand: beanmachine.ppl.compiler.bmg_nodes.BMGNode)

Bases: beanmachine.ppl.compiler.bmg_nodes.UnaryOperatorNode

This represents an integer truncation operation; it is generated when a model contains calls to Tensor.int() or int().

inputs: beanmachine.ppl.compiler.bmg_nodes.InputList
outputs: beanmachine.ppl.utils.item_counter.ItemCounter
class beanmachine.ppl.compiler.bmg_nodes.ToMatrixNode(rows: beanmachine.ppl.compiler.bmg_nodes.NaturalNode, columns: beanmachine.ppl.compiler.bmg_nodes.NaturalNode, items: List[beanmachine.ppl.compiler.bmg_nodes.BMGNode])

Bases: beanmachine.ppl.compiler.bmg_nodes.OperatorNode

A 2-d tensor whose elements are graph nodes.

property columns: beanmachine.ppl.compiler.bmg_nodes.NaturalNode
inputs: beanmachine.ppl.compiler.bmg_nodes.InputList
outputs: beanmachine.ppl.utils.item_counter.ItemCounter
property rows: beanmachine.ppl.compiler.bmg_nodes.NaturalNode
class beanmachine.ppl.compiler.bmg_nodes.ToNegativeRealNode(operand: beanmachine.ppl.compiler.bmg_nodes.BMGNode)

Bases: beanmachine.ppl.compiler.bmg_nodes.UnaryOperatorNode

inputs: beanmachine.ppl.compiler.bmg_nodes.InputList
outputs: beanmachine.ppl.utils.item_counter.ItemCounter
class beanmachine.ppl.compiler.bmg_nodes.ToPositiveRealMatrixNode(operand: beanmachine.ppl.compiler.bmg_nodes.BMGNode)

Bases: beanmachine.ppl.compiler.bmg_nodes.UnaryOperatorNode

inputs: beanmachine.ppl.compiler.bmg_nodes.InputList
outputs: beanmachine.ppl.utils.item_counter.ItemCounter
class beanmachine.ppl.compiler.bmg_nodes.ToPositiveRealNode(operand: beanmachine.ppl.compiler.bmg_nodes.BMGNode)

Bases: beanmachine.ppl.compiler.bmg_nodes.UnaryOperatorNode

inputs: beanmachine.ppl.compiler.bmg_nodes.InputList
outputs: beanmachine.ppl.utils.item_counter.ItemCounter
class beanmachine.ppl.compiler.bmg_nodes.ToProbabilityNode(operand: beanmachine.ppl.compiler.bmg_nodes.BMGNode)

Bases: beanmachine.ppl.compiler.bmg_nodes.UnaryOperatorNode

inputs: beanmachine.ppl.compiler.bmg_nodes.InputList
outputs: beanmachine.ppl.utils.item_counter.ItemCounter
class beanmachine.ppl.compiler.bmg_nodes.ToRealMatrixNode(operand: beanmachine.ppl.compiler.bmg_nodes.BMGNode)

Bases: beanmachine.ppl.compiler.bmg_nodes.UnaryOperatorNode

inputs: beanmachine.ppl.compiler.bmg_nodes.InputList
outputs: beanmachine.ppl.utils.item_counter.ItemCounter
class beanmachine.ppl.compiler.bmg_nodes.ToRealNode(operand: beanmachine.ppl.compiler.bmg_nodes.BMGNode)

Bases: beanmachine.ppl.compiler.bmg_nodes.UnaryOperatorNode

inputs: beanmachine.ppl.compiler.bmg_nodes.InputList
outputs: beanmachine.ppl.utils.item_counter.ItemCounter
class beanmachine.ppl.compiler.bmg_nodes.UnaryOperatorNode(operand: beanmachine.ppl.compiler.bmg_nodes.BMGNode)

Bases: beanmachine.ppl.compiler.bmg_nodes.OperatorNode

This is the base type of unary operator nodes.

inputs: beanmachine.ppl.compiler.bmg_nodes.InputList
property operand: beanmachine.ppl.compiler.bmg_nodes.BMGNode
outputs: beanmachine.ppl.utils.item_counter.ItemCounter
class beanmachine.ppl.compiler.bmg_nodes.UniformNode(low: beanmachine.ppl.compiler.bmg_nodes.BMGNode, high: beanmachine.ppl.compiler.bmg_nodes.BMGNode)

Bases: beanmachine.ppl.compiler.bmg_nodes.DistributionNode

The Uniform distribution is a “flat” distribution of values between 0.0 and 1.0.

property high: beanmachine.ppl.compiler.bmg_nodes.BMGNode
inputs: beanmachine.ppl.compiler.bmg_nodes.InputList
property low: beanmachine.ppl.compiler.bmg_nodes.BMGNode
outputs: beanmachine.ppl.utils.item_counter.ItemCounter
class beanmachine.ppl.compiler.bmg_nodes.UntypedConstantNode(value: Any)

Bases: beanmachine.ppl.compiler.bmg_nodes.ConstantNode

inputs: beanmachine.ppl.compiler.bmg_nodes.InputList
outputs: beanmachine.ppl.utils.item_counter.ItemCounter
value: Any
class beanmachine.ppl.compiler.bmg_nodes.VectorIndexNode(left: beanmachine.ppl.compiler.bmg_nodes.BMGNode, right: beanmachine.ppl.compiler.bmg_nodes.BMGNode)

Bases: beanmachine.ppl.compiler.bmg_nodes.BinaryOperatorNode

This represents a stochastic index into a vector. The left operand is the vector and the right operand is the index.

inputs: beanmachine.ppl.compiler.bmg_nodes.InputList
outputs: beanmachine.ppl.utils.item_counter.ItemCounter
beanmachine.ppl.compiler.bmg_nodes.is_one(n: beanmachine.ppl.compiler.bmg_nodes.BMGNode) bool
beanmachine.ppl.compiler.bmg_nodes.is_zero(n: beanmachine.ppl.compiler.bmg_nodes.BMGNode) bool