Distributions

Classes for probability distributions

class ionworkspipeline.data_fits.distributions.Distribution(distribution=None)

Base class for sampling from probability distributions.

cdf(x: float | ndarray) float | ndarray

Cumulative distribution function of the distribution.

Parameters

xfloat or array_like

Points at which to evaluate the CDF.

Returns

cdffloat or ndarray

Cumulative distribution function evaluated at x.

property distribution: Any

Returns the underlying scipy.stats distribution object.

Returns

distributionscipy.stats distribution

The underlying distribution object.

property multivariate: bool

Whether the distribution is multivariate.

Returns

multivariatebool

True if the distribution is multivariate, False otherwise.

pdf(x: float | ndarray) float | ndarray

Probability density function of the distribution.

Parameters

xfloat or array_like

Points at which to evaluate the PDF.

Returns

pdffloat or ndarray

Probability density function evaluated at x.

ppf(U: ndarray) ndarray

Percent point function (inverse of CDF) - transform samples from the standard uniform distribution to the distribution of the class.

Parameters

Unp.ndarray

Samples from the standard uniform distribution.

Returns

samplesnp.ndarray

Transformed samples from the target distribution.

rand(n: int | None = None) ndarray

Draw random samples from the distribution.

Parameters

nint, optional

Number of samples to draw.

Returns

samplesndarray

Random samples from the distribution.

property zero_variance: bool

Whether the distribution has zero variance.

Returns

has_zero_variancebool

True if the distribution has zero variance, False otherwise.

class ionworkspipeline.data_fits.distributions.Normal(mean: float, standard_deviation: float)

Univariate normal distribution.

Extends: ionworkspipeline.data_fits.distributions.distributions.Distribution

property mean: float

Mean of the normal distribution.

Returns

meanfloat

Mean of the distribution.

property multivariate: bool

Whether the distribution is multivariate.

Returns

multivariatebool

Always False for univariate normal.

property standard_deviation: float

Standard deviation of the normal distribution.

Returns

standard_deviationfloat

Standard deviation of the distribution.

class ionworkspipeline.data_fits.distributions.MultivariateNormal(mean: ndarray, cov: ndarray)

Multivariate normal distribution.

Extends: ionworkspipeline.data_fits.distributions.distributions.Distribution

property cov: ndarray

Covariance matrix of the multivariate normal distribution.

Returns

covnp.ndarray

Covariance matrix of the distribution.

property mean: ndarray

Mean vector of the multivariate normal distribution.

Returns

meannp.ndarray

Mean vector of the distribution.

property multivariate: bool

Whether the distribution is multivariate.

Returns

multivariatebool

Always True for multivariate normal.

ppf(U: ndarray) ndarray

Percent point function (inverse of CDF) - transform samples from the standard uniform distribution to the multivariate normal distribution. Vectorized Rosenblatt transform from Uniform(0,1) samples to a correlated multivariate normal N(mu, sigma).

Note: Unlike univariate distributions, the PPF for multivariate distributions is not unique. Many different points in the multivariate space can have the same cumulative probability. This implementation uses the Rosenblatt transformation to create a deterministic mapping from uniform samples to the multivariate normal distribution while preserving the correlation structure.

Parameters

Unp.ndarray

Samples from the standard uniform distribution.

Returns

samplesnp.ndarray

Samples from the multivariate normal distribution.

class ionworkspipeline.data_fits.distributions.Uniform(lb: float, ub: float)

Uniform distribution.

Extends: ionworkspipeline.data_fits.distributions.distributions.Distribution

property lb: float

Lower bound of the uniform distribution.

Returns

lbfloat

Lower bound of the distribution.

property multivariate: bool

Whether the distribution is multivariate.

Returns

multivariatebool

Always False for univariate uniform.

property ub: float

Upper bound of the uniform distribution.

Returns

ubfloat

Upper bound of the distribution.

class ionworkspipeline.data_fits.distributions.LogNormal(mean: float, standard_deviation: float)

Univariate lognormal distribution.

Extends: ionworkspipeline.data_fits.distributions.distributions.Distribution

property mean: float

Mean of the underlying normal distribution.

Returns

meanfloat

Mean of the underlying normal distribution.

property multivariate: bool

Whether the distribution is multivariate.

Returns

multivariatebool

Always False for univariate lognormal.

ppf(U: ndarray) ndarray

Percent point function (inverse of CDF) - transform samples from the standard uniform distribution to the lognormal distribution.

Parameters

Unp.ndarray

Samples from the standard uniform distribution.

Returns

samplesnp.ndarray

Samples from the lognormal distribution.

property standard_deviation: float

Standard deviation of the underlying normal distribution.

Returns

standard_deviationfloat

Standard deviation of the underlying normal distribution.

class ionworkspipeline.data_fits.distributions.MultivariateLogNormal(mean: ndarray, cov: ndarray)

Multivariate lognormal distribution.

Extends: ionworkspipeline.data_fits.distributions.distributions.Distribution

cdf(x: ndarray) float

Cumulative distribution function of the multivariate lognormal distribution.

Parameters

xarray_like

Points at which to evaluate the CDF.

Returns

cdffloat

Cumulative distribution function evaluated at x.

property cov: ndarray

Covariance matrix of the underlying multivariate normal distribution.

Returns

covnp.ndarray

Covariance matrix of the underlying multivariate normal distribution.

property mean: ndarray

Mean vector of the underlying multivariate normal distribution.

Returns

meannp.ndarray

Mean vector of the underlying multivariate normal distribution.

property multivariate: bool

Whether the distribution is multivariate.

Returns

multivariatebool

Always True for multivariate lognormal.

pdf(x: ndarray) float

Probability density function of the multivariate lognormal distribution.

Parameters

xarray_like

Points at which to evaluate the PDF.

Returns

pdffloat

Probability density function evaluated at x.

ppf(U: ndarray) ndarray

Percent point function (inverse of CDF) - transform samples from the standard uniform distribution to the multivariate lognormal distribution.

Parameters

Unp.ndarray

Samples from the standard uniform distribution.

Returns

samplesnp.ndarray

Samples from the multivariate lognormal distribution.

rand(n: int | None = None) ndarray

Draw random samples from the distribution.

Parameters

nint, optional

Number of samples to draw.

Returns

samplesnp.ndarray

Random samples from the multivariate lognormal distribution.

class ionworkspipeline.data_fits.distributions.PointMass(value: float)

PointMass distribution (constant value).

Extends: ionworkspipeline.data_fits.distributions.distributions.Distribution

cdf(x: float | ndarray) float | ndarray

Cumulative distribution function of the point mass distribution.

Parameters

xfloat or array_like

Points at which to evaluate the CDF.

Returns

cdffloat or ndarray

Cumulative distribution function evaluated at x (0 for x < value, 1 for x >= value).

property multivariate: bool

Whether the distribution is multivariate.

Returns

multivariatebool

Always False for point mass.

pdf(x: float | ndarray) float | ndarray

Probability density function of the point mass distribution.

Parameters

xfloat or array_like

Points at which to evaluate the PDF.

Returns

pdffloat or ndarray

Probability density function evaluated at x (infinity at the constant value, 0 elsewhere).

ppf(U: ndarray) ndarray

Percent point function (inverse of CDF) - transform samples from the standard uniform distribution to the point mass distribution.

Parameters

Unp.ndarray

Samples from the standard uniform distribution.

Returns

samplesnp.ndarray

Samples from the point mass distribution (all equal to the constant value).

rand(n: int | None = None) ndarray

Draw random samples from the distribution.

Parameters

nint, optional

Number of samples to draw.

Returns

samplesndarray

Samples from the point mass distribution (all equal to the constant value).

property value: float

The constant value of the point mass distribution.

Returns

valuefloat

The constant value.

property zero_variance: bool

Whether the distribution has zero variance.

Returns

has_zero_variancebool

Always True for point mass.