probabilistic_model.probabilistic_circuit.jax.gaussian_layer#

Classes#

GaussianLayer

A layer that represents uniform distributions over a single variable.

Module Contents#

class probabilistic_model.probabilistic_circuit.jax.gaussian_layer.GaussianLayer(variable: int, location: jax.numpy.array, log_scale: jax.numpy.array, min_scale: jax.numpy.array)#

Bases: probabilistic_model.probabilistic_circuit.jax.input_layer.ContinuousLayer

A layer that represents uniform distributions over a single variable.

location: jax.numpy.array#
log_scale: jax.numpy.array#
min_scale: jax.numpy.array#
__deepcopy__(memo=None)#

Create a deep copy of the layer.

Parameters:

memo – A dictionary that is used to keep track of objects that have already been copied.

classmethod nx_classes() typing_extensions.Tuple[typing_extensions.Type, Ellipsis]#
Returns:

The tuple of matching classes of the layer in the probabilistic_model.probabilistic_circuit.rx package.

validate()#

Validate the parameters and their layouts.

property number_of_nodes: int#
Returns:

The number of nodes in the layer.

property scale: jax.numpy.array#
log_likelihood_of_nodes_single(x: jax.numpy.array) jax.numpy.array#

Calculate the log-likelihood of the distribution.

Parameters:

x – The input vector.

Returns:

The log-likelihood of every node in the layer for x.

log_likelihood_of_nodes(x: jax.numpy.array) jax.numpy.array#

Vectorized version of log_likelihood_of_nodes_single()

classmethod create_layer_from_nodes_with_same_type_and_scope(nodes: List[probabilistic_model.probabilistic_circuit.rx.probabilistic_circuit.UnivariateContinuousLeaf], child_layers: List[probabilistic_model.probabilistic_circuit.jax.inner_layer.NXConverterLayer], progress_bar: bool = True) probabilistic_model.probabilistic_circuit.jax.inner_layer.NXConverterLayer#

Create a layer from a list of nodes with the same type and scope.

to_json() Dict[str, Any]#
classmethod _from_json(data: Dict[str, Any]) typing_extensions.Self#

Create a variable from a json dict. This method is called from the from_json method after the correct subclass is determined and should be overwritten by the respective subclass.

Parameters:

data – The json dict

Returns:

The deserialized object

to_nx(variables: sortedcontainers.SortedSet[random_events.variable.Variable], result: probabilistic_model.probabilistic_circuit.rx.probabilistic_circuit.ProbabilisticCircuit, progress_bar: tqdm.tqdm | None = None) List[probabilistic_model.probabilistic_circuit.rx.probabilistic_circuit.Unit]#

Convert the layer to a networkx circuit. For every node in this circuit, a corresponding node in the networkx circuit is created. The nodes all belong to the same circuit.

Parameters:
  • variables – The variables of the circuit.

  • result – The resulting circuit to write into

  • progress_bar – A progress bar to show the progress.

Returns:

The nodes of the networkx circuit.