pyjuice.nodes

Nodes

CircuitNodes

The base class for a vector (block) of circuit nodes that share the same scope and structure.

InputNodes

A class representing vectors of input nodes.

ProdNodes

A class representing vectors of product nodes.

SumNodes

A class representing vectors of sum nodes.

Methods

foreach

Traverse all nodes of a PC and can a specific function.

foldup_aggregate

Traverse all nodes of a PC bottom-up and aggregate a per-node object.

Edge Constructors

Helpers that build structured (block-diagonal or block-sparse) edge patterns, passed as the edge_ids argument of summate().

edge_constructors.block_diagonal_edge_constructor

An edge constructor that connects sum and child node blocks in a one-to-one (block-diagonal) pattern: the i-th sum node block is connected only to the i-th child node block.

edge_constructors.block_sparse_rnd_blk_edge_constructor

An edge constructor that connects every sum node block to num_chs_per_block randomly chosen child node blocks, yielding a block-sparse (rather than fully-connected) sum layer.

Input Distributions

distributions.Bernoulli

A class representing Bernoulli distributions.

distributions.Categorical

A class representing Categorical distributions.

distributions.DiscreteLogistic

A class representing Discrete Logistic distributions.

distributions.Gaussian

A class representing Gaussian distributions.

distributions.MaskedCategorical

A class representing Categorical distributions with masks.

distributions.Literal

A class representing Literal (indicator) distributions.

distributions.Indicator

A class representing Indicator distributions.

distributions.SoftEvidenceCategorical

A class representing a Categorical distribution that allows external soft evidence.

distributions.SoftEvidenceIndicator

A class representing an Indicator distribution that allows external soft evidence.

distributions.External

A class representing user-define distributions (PyJuice only processes the incoming log-probabilities).

distributions.ExternProductCategorical

A class representing a product distribution of two Categorical distributions: Pr_{A} * Pr_{B}.