probabilistic_model.probabilistic_circuit.jax.uniform_layer#

Classes#

UniformLayer

A layer that represents uniform distributions over a single variable.

Module Contents#

class probabilistic_model.probabilistic_circuit.jax.uniform_layer.UniformLayer(variable: int, interval: jax.Array)#

Bases: probabilistic_model.probabilistic_circuit.jax.input_layer.ContinuousLayerWithFiniteSupport

A layer that represents uniform distributions over a single variable.

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.

log_pdf_value() jax.numpy.array#

Calculate the log-density of the uniform distribution.

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.

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.