ContinuousDistribution#
- class ContinuousDistribution[source]#
Bases:
ABCAbstract base class for continuous distributions.
This class defines the basic mathematical functions of distributions that must be implemented by specific distributions. This class also provides some functions that are common to all distributions.
Instances of subclasses can be compared for equality (
==) and inequality (!=). Two instances are considered equal if they are of the exact same type and have identical parameter values.- Variables:
name (str) – The name of the distribution (e.g., ‘Normal’, ‘Gamma’).
params (set[str]) – The names of all parameters of the distribution
params_to_optimize (set[str]) – Parameters names that are not fixed and can be optimized.
fixed_params (set[str]) – A set of parameter names that are fixed and not subject to optimization.
Methods
Implemented methods
fix_param(name)Fixes a parameter, excluding it from optimization and further changes.
unfix_param(name)Unfixes a parameter, allowing it to be changed again.
get_params_vector(param_names)Retrieves specified parameter values as a list.
set_params_from_vector(param_names, vector)Sets parameter values from a sequence of floats.
Abstract methods
ppf(P)Percent Point Function (PPF) or quantile function.
pdf(X)Probability Density Function.
lpdf(X)Logarithm of the Probability Density Function.
Calculates the gradients of the log-PDF with respect to its parameters.
generate(size)Generates random samples from the distribution.
Notes
Key Functionality
Parameter management: fixing and releasing parameters for optimization.
Parameter vectorization: getting and setting parameters from a numpy vector.
Implementation Requirements
Subclasses must:
Implement the
nameproperty to identify the distribution.Implement the
paramsproperty to return all parameter names.Implement the abstract methods:
pdf(),ppf(),lpdf(),log_gradients(), andgenerate().Define their parameters as instance attributes (e.g.,
self.loc,self.scale) with arework_pysatl_mpest.core.Parameterdescriptor.