askcarl package
Submodules
askcarl.gaussian module
Multivariate Gaussians with support for upper limits and missing data.
- askcarl.gaussian.pdfcdf(x, mask, mean, cov)[source]
Compute the mixed PDF and CDF for a multivariate Gaussian distribution.
- Parameters:
x (array) – The point (vector) at which to evaluate the probability.
mask (array) – A boolean mask of the same shape as x, indicating whether the entry is a value (True) or a upper bound (False).
mean (array) – mean vector of the multivariate normal distribution.
cov (array) – covariance matrix of the multivariate normal distribution.
- Returns:
pdf – Probability density
- Return type:
float
- class askcarl.gaussian.Gaussian(mean, cov)[source]
Bases:
object
Multivariate Gaussians with support for upper limits and missing data.
Initialize.
- Parameters:
mean (array) – mean vector of the multivariate normal distribution.
cov (array) – covariance matrix of the multivariate normal distribution.
- get_conditional_rv(mask)[source]
Build conditional distribution.
- Parameters:
mask (array) – A boolean mask, indicating whether the entry is a value (True) or a upper bound (False).
- Returns:
cov_cross (array) – Covariance matrix part of upper bound and value dimensions.
cov_exact (array) – Covariance matrix part of value dimensions.
inv_cov_exact (array) – Inverse covariance matrix part of value dimensions.
rv (scipy.stats.multivariate_normal) – Multivariate Normal Distribution of the upper bound dimensions, conditioned with mask.
- conditional_pdf(x, mask=Ellipsis)[source]
Compute conditional PDF.
- Parameters:
x (array) – The points (vector) at which to evaluate the probability.
mask (array) – A boolean mask of the same shape as x.shape[1], indicating whether the entry is a value (True) or a upper bound (False).
- Returns:
pdf – Probability density. One value for each x.
- Return type:
array
- conditional_logpdf(x, mask=Ellipsis)[source]
Compute conditional log-PDF.
- Parameters:
x (array) – The points (vector) at which to evaluate the probability.
mask (array) – A boolean mask of the same shape as x.shape[1], indicating whether the entry is a value (True) or a upper bound (False).
- Returns:
logpdf – logarithm of the probability density. One value for each x.
- Return type:
array
- pdf(x, mask)[source]
Compute conditional PDF.
- Parameters:
x (array) – The points (vector) at which to evaluate the probability.
mask (array) – A boolean mask of the same shape as x, indicating whether the entry is a value (True) or a upper bound (False).
- Returns:
pdf – probability density. One value for each x.
- Return type:
array
- logpdf(x, mask)[source]
Compute conditional log-PDF.
- Parameters:
x (array) – The points (vector) at which to evaluate the probability.
mask (array) – A boolean mask of the same shape as x, indicating whether the entry is a value (True) or a upper bound (False).
- Returns:
logpdf – logarithm of the probability density. One value for each x.
- Return type:
array
askcarl.mixture module
Mixture of Gaussians.
- class askcarl.mixture.GaussianMixture(weights, means, covs)[source]
Bases:
object
Mixture of Gaussians.
- weights
weight for each Gaussian component
- Type:
list
- components
list of Gaussian components.
- Type:
list
Initialize.
- Parameters:
weights (list) – weight for each Gaussian component
means (list) – mean vector for each Gaussian component.
covs (list) – covariance matrix for each Gaussian component.
- static from_pypmc(mix)[source]
Initialize from a pypmc Gaussian mixture model (GMM).
- Parameters:
mix (pypmc.density.mixture.GaussianMixture) – Gaussian mixture.
- Returns:
mix – Generalized Gaussian mixture.
- Return type:
GaussianMixture
- static from_sklearn(skgmm)[source]
Initialize from a scikit-learn Gaussian mixture model (GMM).
- Parameters:
mix (sklearn.mixture.GaussianMixture) – Gaussian mixture.
- Returns:
mix – Generalized Gaussian mixture.
- Return type:
GaussianMixture
- pdf(x, mask)[source]
Compute probability density at x.
- Parameters:
x (array) – The points (vector) at which to evaluate the probability.
mask (array) – A boolean mask of the same shape as x, indicating whether the entry is a value (True) or a upper bound (False).
- Returns:
pdf – probability density. One value for each x.
- Return type:
array
- logpdf(x, mask)[source]
Compute logarithm of probability density.
- Parameters:
x (array) – The points (vector) at which to evaluate the probability.
mask (array) – A boolean mask of the same shape as x, indicating whether the entry is a value (True) or a upper bound (False).
- Returns:
logpdf – logarithm of the probability density. One value for each x.
- Return type:
array
Module contents
Multivariate Gaussians with support for upper limits and missing data.