Distributions#
- class quantflow.utils.distributions.Exponential(*, decay: Annotated[float, Gt(gt=0)] = 1)#
A
Marginal1D
for the Exponential distributionThe exponential distribution is a continuous probability distribution with PDF given by
\[f(x) = \lambda e^{-\lambda x}\ \ \forall x \geq 0\]Methods:
The analytical CDF of the exponential distribution
Compute the characteristic function on support points n.
Expected value
The analytical PDF of the exponential distribution as defined above
Sample from the distribution
Compute the x axis.
Variance
Attributes:
The exponential decay rate \(\lambda\)
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
The scale parameter, it is the inverse of the
decay
rate- cdf(x: ndarray[tuple[int, ...], dtype[floating[Any]]] | float) ndarray[tuple[int, ...], dtype[floating[Any]]] | float #
The analytical CDF of the exponential distribution
\[F(x) = 1 - e^{-\lambda x}\ \ \forall x \geq 0\]
- characteristic(u: int | float | complex | ndarray | Series) int | float | complex | ndarray | Series #
Compute the characteristic function on support points n.
- mean() float #
Expected value
This should be overloaded if a more efficient way of computing the mean
- pdf(x: ndarray[tuple[int, ...], dtype[floating[Any]]] | float) ndarray[tuple[int, ...], dtype[floating[Any]]] | float #
The analytical PDF of the exponential distribution as defined above
- sample(n: int) ndarray #
Sample from the distribution
- support(points: int = 100, *, std_mult: float = 4) ndarray[tuple[int, ...], dtype[floating[Any]]] #
Compute the x axis.
- variance() float #
Variance
This should be overloaded if a more efficient way of computing the
- decay: float#
The exponential decay rate \(\lambda\)
- model_config: ClassVar[ConfigDict] = {'extra': 'forbid'}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class quantflow.utils.distributions.DoubleExponential(*, decay: Annotated[float, Gt(gt=0)] = 1, loc: float = 0, kappa: Annotated[float, Gt(gt=0)] = 1)#
A
Marginal1D
for the generalized double exponential distributionThis is also know as the Asymmetric Laplace distribution (ALD) which is a continuous probability distribution with PDF
\[\begin{split}\begin{align} f(x) &= \frac{\lambda}{\kappa + \frac{1}{\kappa}} e^{-\left(x - m\right) \lambda s(x) \kappa^{s(x)}}\\ s(x) &= {\tt sgn}\left({x - m}\right) \end{align}\end{split}\]where m is the
loc
parameter, \(\lambda\) is thedecay
parameter, and \(\kappa\) is the asymmetrickappa
parameter.The Asymmetric Laplace distribution is similar to the Gaussian/normal distribution, but is sharper at the peak, it has fatter tails and allow for skewness. It represents the difference between two independent, exponential random variables.
Methods:
Characteristic function of the double exponential distribution
Create a double exponential distribution from the mean, variance and asymmetry
The mean of the double exponential distribution
The analytical PDF as defined above
Sample from the double exponential distribution
Compute the x axis.
Variance
Attributes:
The exponential decay rate \(\lambda\)
Asymmetric parameter - when k=1, the distribution is symmetric
The location parameter m
The log of the
kappa
parameterConfiguration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- characteristic(u: int | float | complex | ndarray | Series) int | float | complex | ndarray | Series #
Characteristic function of the double exponential distribution
\[\phi(u) = \frac{e^{i u \mu}}{1 - \sigma^2 u^2}\]
- classmethod from_moments(*, mean: float = 0, variance: float = 1, kappa: float = 1) Self #
Create a double exponential distribution from the mean, variance and asymmetry
- Parameters:
mean – The mean of the distribution
variance – The variance of the distribution
kappa – The asymmetry parameter of the distribution, 1 for symmetric
- mean() float #
The mean of the double exponential distribution
- pdf(x: ndarray[tuple[int, ...], dtype[floating[Any]]] | float) ndarray[tuple[int, ...], dtype[floating[Any]]] | float #
The analytical PDF as defined above
- sample(n: int) ndarray #
Sample from the double exponential distribution
- support(points: int = 100, *, std_mult: float = 4) ndarray[tuple[int, ...], dtype[floating[Any]]] #
Compute the x axis.
- variance() float #
Variance
This should be overloaded if a more efficient way of computing the
- decay: float#
The exponential decay rate \(\lambda\)
- kappa: float#
Asymmetric parameter - when k=1, the distribution is symmetric
- loc: float#
The location parameter m
- model_config: ClassVar[ConfigDict] = {'extra': 'forbid'}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class quantflow.utils.distributions.Normal(*, mu: float = 0, sigma: Annotated[float, Gt(gt=0)] = 1)#
Methods:
Compute the characteristic function on support points n.
Expected value
Sample from the distribution
Compute the x axis.
Variance
Attributes:
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- characteristic(u: int | float | complex | ndarray | Series) int | float | complex | ndarray | Series #
Compute the characteristic function on support points n.
- mean() float #
Expected value
This should be overloaded if a more efficient way of computing the mean
- sample(n: int) ndarray #
Sample from the distribution
- support(points: int = 100, *, std_mult: float = 4) ndarray[tuple[int, ...], dtype[floating[Any]]] #
Compute the x axis.
- variance() float #
Variance
This should be overloaded if a more efficient way of computing the
- model_config: ClassVar[ConfigDict] = {'extra': 'forbid'}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].