leaspy.variables.distributions ============================== .. py:module:: leaspy.variables.distributions .. autoapi-nested-parse:: This module defines the distributions used for sampling variables. .. !! processed by numpydoc !! Attributes ---------- .. autoapisummary:: leaspy.variables.distributions.Normal leaspy.variables.distributions.Bernoulli leaspy.variables.distributions.WeibullRightCensored leaspy.variables.distributions.WeibullRightCensoredWithSources Classes ------- .. autoapisummary:: leaspy.variables.distributions.StatelessDistributionFamily leaspy.variables.distributions.StatelessDistributionFamilyFromTorchDistribution leaspy.variables.distributions.BernoulliFamily leaspy.variables.distributions.NormalFamily leaspy.variables.distributions.MultivariateNormalFamily leaspy.variables.distributions.MixtureNormalFamily leaspy.variables.distributions.AbstractWeibullRightCensoredFamily leaspy.variables.distributions.WeibullRightCensoredFamily leaspy.variables.distributions.WeibullRightCensoredWithSourcesFamily leaspy.variables.distributions.SymbolicDistribution Module Contents --------------- .. py:class:: StatelessDistributionFamily Bases: :py:obj:`abc.ABC` Abstract base class defining a stateless interface for distribution families. This class represents a family of probability distributions in a stateless manner: no parameters are stored in the instance. All methods operate purely via classmethods, using explicitly passed distribution parameters. .. rubric:: Notes - Subclasses must define the `parameters` class variable, listing parameter names in order. - Each method operates solely on the passed tensors; no state or caching is assumed. .. !! processed by numpydoc !! .. py:attribute:: parameters :type: ClassVar[tuple[str, Ellipsis]] .. py:method:: validate_parameters(*params) :classmethod: :abstractmethod: Validate consistency of distribution parameters, returning them with out-of-place modifications if needed. .. !! processed by numpydoc !! .. py:method:: shape(*params_shapes) :classmethod: Shape of distribution samples (without any additional expansion), given shapes of distribution parameters. :Parameters: **\*params_shapes** : :obj:`tuple` of :obj:`int` The shapes of the distribution parameters, passed in the order defined by `cls.parameters`. :Returns: :obj:`tuple` of :obj:`int` The shape of the distribution samples. :Raises: :exc:`LeaspyInputError` If the number of provided shapes does not match the expected number of parameters. :exc:`NotImplementedError` If the distribution has no parameters, and sample shape cannot be inferred. .. !! processed by numpydoc !! .. py:method:: sample(*params, sample_shape = ()) :classmethod: :abstractmethod: Sample values, given distribution parameters (`sample_shape` is prepended to shape of distribution parameters). .. !! processed by numpydoc !! .. py:method:: mode(*params) :classmethod: :abstractmethod: Mode of distribution (returning first value if discrete ties), given distribution parameters. .. !! processed by numpydoc !! .. py:method:: mean(*params) :classmethod: :abstractmethod: Mean of distribution (if defined), given distribution parameters. .. !! processed by numpydoc !! .. py:method:: stddev(*params) :classmethod: :abstractmethod: Standard-deviation of distribution (if defined), given distribution parameters. .. !! processed by numpydoc !! .. py:method:: nll(x, *params) :classmethod: Negative log-likelihood of value, given distribution parameters. .. !! processed by numpydoc !! .. py:method:: regularization(x, *params) :classmethod: Negative log-likelihood of value, given distribution parameters. .. !! processed by numpydoc !! .. py:method:: nll_jacobian(x, *params) :classmethod: Jacobian w.r.t. value of negative log-likelihood, given distribution parameters. .. !! processed by numpydoc !! .. py:method:: nll_and_jacobian(x, *params) :classmethod: Negative log-likelihood of value and its jacobian w.r.t. value, given distribution parameters. .. !! processed by numpydoc !! .. py:class:: StatelessDistributionFamilyFromTorchDistribution Bases: :py:obj:`StatelessDistributionFamily` Wrapper to build a `StatelessDistributionFamily` class from an existing torch distribution class. :Attributes: **dist_factory** : :obj:`Callable` [..., :class:`torch.distributions.Distribution`] A class variable that points to a factory function or class used to instantiate the corresponding PyTorch distribution. .. !! processed by numpydoc !! .. py:attribute:: dist_factory :type: ClassVar[Callable[Ellipsis, torch.distributions.Distribution]] .. py:method:: validate_parameters(*params) :classmethod: Validate consistency of distribution parameters, returning them with out-of-place modifications if needed. :Parameters: **params** : Any The parameters to pass to the distribution factory. :Returns: :obj:`tuple` [ :class:`torch.Tensor`, ...] The validated parameters. .. !! processed by numpydoc !! .. py:method:: sample(*params, sample_shape = ()) :classmethod: Sample values, given distribution parameters (`sample_shape` is prepended to shape of distribution parameters). :Parameters: **params** : :class:`torch.Tensor` The distribution parameters. **sample_shape** : :obj:`tuple` of :obj:`int`, optional Desired shape of the sample batch (prepended to the shape of a single sample). Defaults to an empty tuple, i.e., a single sample. :Returns: :class:`torch.Tensor` Sampled tensor .. !! processed by numpydoc !! .. py:method:: mode(*params) :classmethod: :abstractmethod: Mode of distribution (returning first value if discrete ties), given distribution parameters. This method should be overridden in subclasses that wrap torch distributions which explicitly define a mode. :Parameters: **params** : :class:`torch.Tensor` The distribution parameters. :Returns: :class:`torch.Tensor` The value of the distribution's mode. :Raises: :exc:`NotImplementedError` If the mode is not explicitly implemented for the specific distribution subclass. .. !! processed by numpydoc !! .. py:method:: mean(*params) :classmethod: Return the mean of the distribution, if defined. :Parameters: **params** : :class:`torch.Tensor` The distribution parameters. :Returns: :class:`torch.Tensor` The value of the distribution's mean. .. !! processed by numpydoc !! .. py:method:: stddev(*params) :classmethod: Return the standard-deviation of the distribution. :Parameters: **params** : :class:`torch.Tensor` The distribution parameters. :Returns: :class:`torch.Tensor` The value of the distribution's standard deviation. .. !! processed by numpydoc !! .. py:class:: BernoulliFamily Bases: :py:obj:`StatelessDistributionFamilyFromTorchDistribution` Bernoulli family (stateless). Inherits from `StatelessDistributionFamilyFromTorchDistribution`. .. !! processed by numpydoc !! .. py:attribute:: parameters :type: ClassVar :value: ('loc',) .. py:attribute:: dist_factory :type: ClassVar .. py:class:: NormalFamily Bases: :py:obj:`StatelessDistributionFamilyFromTorchDistribution` Normal / Gaussian family (stateless). Inherits from `StatelessDistributionFamilyFromTorchDistribution`. .. !! processed by numpydoc !! .. py:attribute:: parameters :type: ClassVar :value: ('loc', 'scale') .. py:attribute:: dist_factory :type: ClassVar .. py:attribute:: nll_constant_standard :type: ClassVar .. py:method:: mode(loc, scale) :classmethod: Return the mode of the distribution given the distribution's loc and scale parameters. :Parameters: **loc** : :class:`torch.Tensor` The distribution loc. **scale** : :class:`torch.Tensor` The distribution scale. :Returns: :class:`torch.Tensor` The value of the distribution's mode. .. !! processed by numpydoc !! .. py:method:: mean(loc, scale) :classmethod: Return the mean of the distribution, given the distribution loc and scale parameters. :Parameters: **loc** : :class:`torch.Tensor` The distribution loc parameters. **scale** : :class:`torch.Tensor` The distribution scale parameters. :Returns: :class:`torch.Tensor` The value of the distribution's mean. .. !! processed by numpydoc !! .. py:method:: stddev(loc, scale) :classmethod: Return the standard-deviation of the distribution, given loc and scale of the distribution. :Parameters: **loc** : :class:`torch.Tensor` The distribution loc parameter. **scale** : :class:`torch.Tensor` The distribution scale parameter. :Returns: :class:`torch.Tensor` The value of the distribution's standard deviation. .. !! processed by numpydoc !! .. py:class:: MultivariateNormalFamily Bases: :py:obj:`StatelessDistributionFamily` Multivariate Normal family with diagonal covariance (stateless). .. !! processed by numpydoc !! .. py:attribute:: parameters :type: ClassVar :value: ('loc', 'scale') .. py:attribute:: dist_factory :type: ClassVar .. py:attribute:: nll_constant_standard :type: ClassVar .. py:method:: multi_dist_factory(loc, scale) :classmethod: .. py:method:: mode(loc, scale) :classmethod: Mode of distribution (returning first value if discrete ties), given distribution parameters. .. !! processed by numpydoc !! .. py:method:: mean(loc, scale) :classmethod: Mean of distribution (if defined), given distribution parameters. .. !! processed by numpydoc !! .. py:method:: stddev(loc, scale) :classmethod: Standard-deviation of distribution (if defined), given distribution parameters. .. !! processed by numpydoc !! .. py:class:: MixtureNormalFamily Bases: :py:obj:`StatelessDistributionFamily` A stateless mixture of univariate normal distributions. This class defines a mixture distribution where each component is a univariate normal distribution, and the mixture weights are defined by a categorical distribution. Parameters: - loc (Tensor): Mean of each normal component, one for each cluster. - scale (Tensor): Standard deviation of each normal component. - probs (Tensor): Probabilities associated with each cluster; must sum to 1. The mixture is modeled using `torch.distributions.MixtureSameFamily`, where: - The mixing distribution is a `Categorical` defined by `probs`. - The component distribution is `Normal(loc, scale)`. .. !! processed by numpydoc !! .. py:attribute:: parameters :type: ClassVar :value: ('loc', 'scale', 'probs') .. py:attribute:: nll_constant_standard :type: ClassVar .. py:method:: dist_factory(loc, scale, probs) :classmethod: Construct a MixtureSameFamily distribution of univariate normal components. :Parameters: **loc** : :class:`torch.Tensor` Mean(s) of the normal components. Shape should be broadcastable with `scale` and `probs`. **scale** : :class:`torch.Tensor` Standard deviation(s) of the normal components. **probs** : :class:`torch.Tensor` Probabilities of each mixture component. Must sum to 1 along the component axis. :Returns: :class: `.MixtureSameFamily` A mixture distribution with categorical mixing and normal components. .. !! processed by numpydoc !! .. py:method:: sample(*params, sample_shape = ()) :classmethod: Draw samples from the mixture of normal distributions. :Parameters: **\*params** : :class:`torch.Tensor` Distribution parameters in the order (loc, scale, probs). These should be broadcastable to define a valid MixtureSameFamily distribution. **sample_shape** : :obj:`tuple` of :obj:`int`, optional The desired sample shape. Defaults to an empty tuple for a single sample. :Returns: :class:`torch.Tensor` A tensor of samples drawn from the specified mixture distribution. The shape is `sample_shape + batch_shape`. .. !! processed by numpydoc !! .. py:method:: set_component_distribution(component_distribution, loc, scale) :classmethod: Ensure that the component distribution is an instance of the :class:`torch.distributions.Normal`. :Parameters: **component_distribution** : :class:`torch.distributions.Distribution` The distribution object to validate. Must be an instance of `torch.distributions.Normal`. **loc** : :class:`torch.Tensor` Mean(s) for the normal distribution. **scale** : :class:`torch.Tensor` Standard deviation(s) for the normal distribution. :Returns: :class:`torch.distributions.Distribution` The newly set Normal distribution instance. :Raises: :exc:`ValueError` If `component_distribution` is not an instance of `torch.distributions.Normal`. .. !! processed by numpydoc !! .. py:method:: extract_probs(*params) :classmethod: Extract the mixture probabilities from the distribution parameters. :Parameters: **\*params** : :obj:`Any` Distribution parameters (expected: loc, scale, probs), passed to `dist_factory`. :Returns: :class:`torch.Tensor` A 1D tensor of probabilities for each component in the mixture. .. !! processed by numpydoc !! .. py:method:: extract_n_clusters(*params) :classmethod: Return the number of mixture components (i.e., clusters) in the distribution. :Parameters: **\*params** : :obj:`Any` Distribution parameters (expected: loc, scale, probs), passed to `extract_probs`. :Returns: :obj:`int` The number of clusters/components in the mixture distribution. .. !! processed by numpydoc !! .. py:method:: extract_cluster_parameters(which_cluster) :classmethod: Extract the parameters (probability, mean, standard deviation) for a specific cluster. :Parameters: **which_cluster** : :obj:`int` The index of the cluster to extract parameters for. :Returns: :obj:`tuple` of :class:`torch.Tensor` A tuple containing: - prob: Probability of the selected cluster. - loc: Mean of the selected normal component. - scale: Standard deviation of the selected normal component. .. !! processed by numpydoc !! .. py:method:: mode(*params) :classmethod: Return the mode of the mixture distribution. For a mixture of normal distributions, this returns the mean of the overall mixture distribution, which serves as a proxy for the mode. :Parameters: **\*params** : :obj:`Any` Distribution parameters (expected: loc, scale, probs), passed to `dist_factory`. :Returns: :class:`torch.Tensor` The mode of the mixture distribution. .. !! processed by numpydoc !! .. py:method:: mean(*params) :classmethod: Return the mean of the mixture distribution. For a mixture of normal distributions, this returns the mean of the overall mixture distribution. :Parameters: **\*params** : :obj:`Any` Distribution parameters (expected: loc, scale, probs), passed to `dist_factory`. :Returns: :class:`torch.Tensor` The mean of the mixture distribution. .. !! processed by numpydoc !! .. py:method:: stddev(*params) :classmethod: Return the standard deviation of the mixture distribution. For a mixture of normal distributions, this returns the standard deviation of the overall mixture distribution. :Parameters: **\*params** : :obj:`Any` Distribution parameters (expected: loc, scale, probs), passed to `dist_factory`. :Returns: :class:`torch.Tensor` The standard deviation of the mixture distribution. .. !! processed by numpydoc !! .. py:class:: AbstractWeibullRightCensoredFamily Bases: :py:obj:`StatelessDistributionFamily` Abstract base class defining a stateless interface for distribution families. This class represents a family of probability distributions in a stateless manner: no parameters are stored in the instance. All methods operate purely via classmethods, using explicitly passed distribution parameters. .. rubric:: Notes - Subclasses must define the `parameters` class variable, listing parameter names in order. - Each method operates solely on the passed tensors; no state or caching is assumed. .. !! processed by numpydoc !! .. py:attribute:: dist_weibull :type: ClassVar .. py:attribute:: precision :type: float :value: 0.0001 .. py:method:: validate_parameters(*params) :classmethod: :abstractmethod: Validate consistency of distribution parameters, returning them with out-of-place modifications if needed. :Parameters: **params** : Any The parameters to pass to the distribution factory. :Returns: :obj:`tuple` [ :class:`torch.Tensor`, ...] The validated parameters. .. !! processed by numpydoc !! .. py:method:: sample(nu, rho, xi, tau, sample_shape = ()) :classmethod: Sample values from a Weibull distribution. :Parameters: **nu** : :class:`torch.Tensor` .. **rho** : :class:`torch.Tensor` .. **xi** : :class:`torch.Tensor` .. **tau** : :class:`torch.Tensor` .. **sample_shape** : :obj:`tuple` of :obj:`int`, optional Shape of the samples to draw :Returns: :class:`torch.Tensor` Samples drawn from the transformed Weibull distribution, shaped according to `sample_shape` combined with the distribution parameter shapes. .. !! processed by numpydoc !! .. py:method:: mode(*params) :classmethod: :abstractmethod: Return the mode of the distribution (returning first value if discrete ties). :Parameters: **params** : :class:`torch.Tensor` The distribution parameters. :Returns: :class:`torch.Tensor` The value of the distribution's mode. .. !! processed by numpydoc !! .. py:method:: mean(nu, rho, xi, tau) :classmethod: Return the mean of the distribution, if defined. :Parameters: **nu** : :class:`torch.Tensor` .. **rho** : :class:`torch.Tensor` .. **xi** : :class:`torch.Tensor` .. **tau** : :class:`torch.Tensor` .. :Returns: :class:`torch.Tensor` The value of the distribution's mean. .. !! processed by numpydoc !! .. py:method:: stddev(nu, rho, xi, tau) :classmethod: Return the standard-deviation of the distribution, given distribution parameters. :Parameters: **nu** : :class:`torch.Tensor` .. **rho** : :class:`torch.Tensor` .. **xi** : :class:`torch.Tensor` .. **tau** : :class:`torch.Tensor` .. :Returns: :class:`torch.Tensor` The value of the distribution's standard deviation. .. !! processed by numpydoc !! .. py:method:: compute_log_likelihood_hazard(x, nu, rho, xi, tau, *params) :classmethod: Compute the log hazard component of the likelihood for given data and parameters. :Parameters: **x** : :class:`~leaspy.utils.weighted_tensor._weighted_tensor.WeightedTensor` The observed data values with associated weights. **nu** : :class:`torch.Tensor` .. **rho** : :class:`torch.Tensor` .. **xi** : :class:`torch.Tensor` .. **tau** : :class:`torch.Tensor` .. **params :class:`torch.Tensor`** Additional parameters for reparametrization if needed. :Returns: :class:`torch.Tensor` The log hazard values for each observation, zeroed out for censored data. .. !! processed by numpydoc !! .. py:method:: compute_hazard(x, nu, rho, xi, tau, *params) :classmethod: Compute the hazard function values for given observations and parameters. :Parameters: **x** : :class:`~leaspy.utils.weighted_tensor._weighted_tensor.WeightedTensor` The observed data values with associated weights. **nu** : :class:`torch.Tensor` .. **rho** : :class:`torch.Tensor` .. **xi** : :class:`torch.Tensor` .. **tau** : :class:`torch.Tensor` .. **params :class:`torch.Tensor`** Additional parameters for reparametrization if needed. :Returns: :class:`torch.Tensor` Hazard values computed for each observation. .. !! processed by numpydoc !! .. py:method:: compute_log_survival(x, nu, rho, xi, tau, *params) :classmethod: Compute the log survival function for the Weibull distribution given observations and parameters. :Parameters: **x** : :class:`torch.Tensor` .. **nu** : :class:`torch.Tensor` .. **rho** : :class:`torch.Tensor` .. **xi** : :class:`torch.Tensor` .. **tau ::class:`torch.Tensor`** .. **params** : :class:`torch.Tensor` Additional optional parameters used in reparametrization. :Returns: :class:`torch.Tensor` Log survival values for each observation. .. !! processed by numpydoc !! .. py:method:: compute_predictions(x, nu, rho, xi, tau, *params) :classmethod: Compute predicted survival or cumulative incidence probabilities for time-to-event data using a reparametrized Weibull model. :Parameters: **x** : :class:`torch.Tensor` .. **nu** : :class:`torch.Tensor` .. **rho** : :class:`torch.Tensor` .. **xi** : :class:`torch.Tensor` .. **tau ::class:`torch.Tensor`** .. **params** : :class:`torch.Tensor` Additional optional parameters used in reparametrization. :Returns: :class:`torch.Tensor` Predicted survival probabilities or cumulative incidence values (depending on event type count), normalized by baseline survival at the last visit. .. !! processed by numpydoc !! .. py:class:: WeibullRightCensoredFamily Bases: :py:obj:`AbstractWeibullRightCensoredFamily` Abstract base class defining a stateless interface for distribution families. This class represents a family of probability distributions in a stateless manner: no parameters are stored in the instance. All methods operate purely via classmethods, using explicitly passed distribution parameters. .. rubric:: Notes - Subclasses must define the `parameters` class variable, listing parameter names in order. - Each method operates solely on the passed tensors; no state or caching is assumed. .. !! processed by numpydoc !! .. py:attribute:: parameters :type: ClassVar :value: ('nu', 'rho', 'xi', 'tau') .. py:class:: WeibullRightCensoredWithSourcesFamily Bases: :py:obj:`AbstractWeibullRightCensoredFamily` Abstract base class defining a stateless interface for distribution families. This class represents a family of probability distributions in a stateless manner: no parameters are stored in the instance. All methods operate purely via classmethods, using explicitly passed distribution parameters. .. rubric:: Notes - Subclasses must define the `parameters` class variable, listing parameter names in order. - Each method operates solely on the passed tensors; no state or caching is assumed. .. !! processed by numpydoc !! .. py:attribute:: parameters :type: ClassVar :value: ('nu', 'rho', 'xi', 'tau', 'survival_shifts') .. py:class:: SymbolicDistribution Class providing symbolic methods for distribution families. .. !! processed by numpydoc !! .. py:attribute:: parameters_names :type: tuple[str, Ellipsis] .. py:attribute:: dist_family :type: Type[StatelessDistributionFamily] .. py:attribute:: validate_parameters :type: Callable[Ellipsis, tuple[torch.Tensor, Ellipsis]] Function of named distribution parameters, to validate these parameters. .. !! processed by numpydoc !! .. py:attribute:: shape :type: Callable[Ellipsis, tuple[int, Ellipsis]] Function of named shapes of distribution parameters, to get shape of distribution samples. .. !! processed by numpydoc !! .. py:attribute:: mode :type: Callable[Ellipsis, torch.Tensor] Function of named distribution parameters, to get mode of distribution. .. !! processed by numpydoc !! .. py:attribute:: mean :type: Callable[Ellipsis, torch.Tensor] Function of named distribution parameters, to get mean of distribution. .. !! processed by numpydoc !! .. py:attribute:: stddev :type: Callable[Ellipsis, torch.Tensor] Function of named distribution parameters, to get std-deviation of distribution. .. !! processed by numpydoc !! .. py:method:: get_func(func, *extra_args_names, **kws) Retrieve a function (e.g., 'sample', 'mode', 'mean') from the associated stateless distribution family, wrapped as a :class:`~leaspy.utils.functional._named_input_function.NamedInputFunction`. :Parameters: **func** : :obj:`str` Name of the method to retrieve from the stateless distribution family. **\*extra_args_names** : :obj:`str` Additional parameter names (e.g., 'sample_shape') to include before standard parameters. **\*\*kws** : :obj:`dict` Optional keyword arguments passed to the :class:`~leaspy.utils.functional._named_input_function.NamedInputFunction`. :Returns: :class:`~leaspy.utils.functional._named_input_function.NamedInputFunction` A callable wrapper over the distribution method with named inputs. .. !! processed by numpydoc !! .. py:method:: get_func_sample(sample_shape = ()) Factory of symbolic sampling function. :Parameters: **sample_shape** : :obj:`tuple` of :obj:`int`, optional The shape of the sample. Default=(). :Returns: :class:`~leaspy.utils.functional.NamedInputFunction` The sample function. .. !! processed by numpydoc !! .. py:method:: get_func_sample_multivariate(sample_shape = ()) Factory of symbolic sampling function. :Parameters: **sample_shape** : tuple of int, optional The shape of the sample. Default=(). :Returns: NamedInputFunction The sample function. .. !! processed by numpydoc !! .. py:method:: get_func_regularization(value_name) Factory method to return a symbolic function computing the negative log-likelihood (used for regularization) from a given value. :Parameters: **value_name** : :obj:`str` .. :Returns: :class:`~leaspy.utils.functional._named_input_function.NamedInputFunction`[:class:`~leaspy.utils.weighted_tensor._weighted_tensor.WeightedTensor`] The named input function to use to compute negative log likelihood. .. !! processed by numpydoc !! .. py:method:: get_func_nll(value_name) Factory method to return a symbolic function computing the negative log-likelihood (NLL) from a given value. :Parameters: **value_name** : :obj:`str` .. :Returns: :class:`~leaspy.utils.functional._named_input_function.NamedInputFunction`[:class:`~leaspy.utils.weighted_tensor._weighted_tensor.WeightedTensor`] The named input function to use to compute negative log likelihood. .. !! processed by numpydoc !! .. py:method:: get_func_nll_jacobian(value_name) Factory of symbolic function: state -> jacobian w.r.t. value of negative log-likelihood. :Parameters: **value_name** : :obj:`str` .. :Returns: :class:`~leaspy.utils.functional.NamedInputFunction` The named input function to use to compute negative log likelihood jacobian. .. !! processed by numpydoc !! .. py:method:: get_func_nll_and_jacobian(value_name) Factory of symbolic function: state -> (negative log-likelihood, its jacobian w.r.t. value). :Parameters: **value_name** : :obj:`str` .. :Returns: :obj:`tuple`[:class:`~leaspy.utils.functional._named_input_function.NamedInputFunction`[:class:`~leaspy.utils.weighted_tensor._weighted_tensor.WeightedTensor`]] The named input functions to use to compute negative log likelihood and its jacobian. .. !! processed by numpydoc !! .. py:method:: bound_to(dist_family) :classmethod: Return a factory to create `SymbolicDistribution` bound to the provided distribution family. :Parameters: **dist_family** : :class:`~leaspy.variables.distributions.StatelessDistributionFamily` The distribution family to use to create a SymbolicDistribution. :Returns: **factory** : :obj:`Callable`[..., :class:`~leaspy.variables.distributions.SymbolicDistribution`] The factory. .. !! processed by numpydoc !! .. py:data:: Normal .. py:data:: Bernoulli .. py:data:: WeibullRightCensored .. py:data:: WeibullRightCensoredWithSources