probabilistic_model.probabilistic_circuit.jax.input_layer#
Classes#
Abstract base class for continuous univariate input units. |
|
Abstract class for continuous univariate input units with finite support. |
|
A layer that represents Dirac delta distributions over a single variable. |
Module Contents#
- class probabilistic_model.probabilistic_circuit.jax.input_layer.ContinuousLayer(variable: int)#
Bases:
probabilistic_model.probabilistic_circuit.jax.inner_layer.InputLayer,abc.ABCAbstract base class for continuous univariate input units.
- class probabilistic_model.probabilistic_circuit.jax.input_layer.ContinuousLayerWithFiniteSupport(variable: int, interval: jax.Array)#
Bases:
ContinuousLayer,abc.ABCAbstract class for continuous univariate input units with finite support.
- interval: jax.Array#
The interval of the distribution as a array of shape (num_nodes, 2). The first column contains the lower bounds and the second column the upper bounds. The intervals are treated as open intervals (>/< comparator).
- property lower: jax.Array#
- property upper: jax.Array#
- left_included_condition(x: jax.Array) jax.Array#
Check if x is included in the left bound of the intervals. :param x: The data :return: A boolean array of shape (#x, #nodes)
- right_included_condition(x: jax.Array) jax.Array#
Check if x is included in the right bound of the intervals. :param x: The data :return: A boolean array of shape (#x, #nodes)
- included_condition(x: jax.Array) jax.Array#
Check if x is included in the interval. :param x: The data :return: A boolean array of shape (#x, #nodes)
- to_json() Dict[str, Any]#
- __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.
- class probabilistic_model.probabilistic_circuit.jax.input_layer.DiracDeltaLayer(variable_index, location, density_cap)#
Bases:
ContinuousLayerA layer that represents Dirac delta distributions over a single variable.
- location: jax.Array#
The locations of the Dirac delta distributions.
- density_cap: jax.Array#
The density caps of the Dirac delta distributions. This value will be used to replace infinity in likelihoods.
- validate()#
Validate the parameters and their layouts.
- property number_of_nodes#
- Returns:
The number of nodes in the layer.
- log_likelihood_of_nodes(x: jax.Array) jax.Array#
Vectorized version of
log_likelihood_of_nodes_single()
- log_likelihood_of_nodes_single(x: jax.Array) jax.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.
- 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.
- 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: typing_extensions.Optional[tqdm.tqdm] = 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.