Library API

Additional distributions

These are the distributions that are not included in the Distributions.jl package.

ExponentialFamily.GammaShapeRateType
GammaShapeRate{T <: Real}

A univariate gamma distribution parametrized by its shape a and rate b.

Fields

  • a: The shape parameter of the gamma distribution. It should be a positive real number.
  • b: The rate parameter of the gamma distribution. It should be a positive real number.
source
ExponentialFamily.GammaShapeScaleType
GammaShapeScale{T}

A continuous univariate gamma distribution parametrized by its shape α and scale β parameters.

Fields

  • α: The shape parameter of the gamma distribution. It should be a positive real number.
  • β: The scale parameter of the gamma distribution. It should be a positive real number.

Note

  • GammaShapeScale is an alias for Gamma from Distributions.jl.
source
ExponentialFamily.NormalMeanPrecisionType
NormalMeanPrecision{T <: Real} <: ContinuousUnivariateDistribution

A normal distribution with a known mean μ and precision w.

Fields

  • μ::T: The mean of the normal distribution.
  • w::T: The precision of the normal distribution.
source
ExponentialFamily.NormalMeanVarianceType
NormalMeanVariance{T <: Real} <: ContinuousUnivariateDistribution

A normal distribution with a known mean μ and variance v.

Fields

  • μ::T: The mean of the normal distribution.
  • v::T: The variance of the normal distribution.
source
ExponentialFamily.NormalWeightedMeanPrecisionType
NormalWeightedMeanPrecision{T <: Real} <: ContinuousUnivariateDistribution

A normal distribution parametrized by its natural parameters: the weighted mean xi and precision w.

Fields

  • xi::T: The weighted mean of the normal distribution. xi is computed as w * μ, where μ is the mean of the distribution.
  • w::T: The precision (inverse variance) of the normal distribution.
source
ExponentialFamily.MvNormalMeanPrecisionType
MvNormalMeanPrecision{T <: Real, M <: AbstractVector{T}, P <: AbstractMatrix{T}} <: AbstractMvNormal

A multivariate normal distribution with mean μ and precision matrix Λ, where T is the element type of the vectors M and matrices P.

Fields

  • μ::M: The mean vector of the multivariate normal distribution.
  • Λ::P: The precision matrix (inverse of the covariance matrix) of the multivariate normal distribution.
source
ExponentialFamily.MvNormalMeanCovarianceType
MvNormalMeanCovariance{T <: Real, M <: AbstractVector{T}, P <: AbstractMatrix{T}} <: AbstractMvNormal

A multivariate normal distribution with mean μ and covariance matrix Σ, where T is the element type of the vectors M and matrices P.

Fields

  • μ::M: The mean vector of the multivariate normal distribution.
  • Σ::P: The covariance matrix of the multivariate normal distribution
source
ExponentialFamily.MvNormalWeightedMeanPrecisionType
MvNormalWeightedMeanPrecision{T <: Real, M <: AbstractVector{T}, P <: AbstractMatrix{T}} <: AbstractMvNormal

A multivariate normal distribution with a weighted mean vector xi and precision matrix Λ, where T is the element type of the vectors M and matrices P. This struct represents a natural parametrization of a multivariate Gaussian distribution.

Fields

  • xi::M: The weighted mean vector of the multivariate normal distribution.
  • Λ::P: The precision matrix (inverse of the covariance matrix) of the multivariate normal distribution.
source
ExponentialFamily.MvNormalMeanScalePrecisionType
MvNormalMeanScalePrecision{T <: Real, M <: AbstractVector{T}} <: AbstractMvNormal

A multivariate normal distribution with mean μ and scale parameter γ that scales the identity precision matrix.

Type Parameters

  • T: The element type of the mean vector and scale parameter
  • M: The type of the mean vector, which must be a subtype of AbstractVector{T}

Fields

  • μ::M: The mean vector of the multivariate normal distribution
  • γ::T: The scale parameter that scales the identity precision matrix

Notes

The precision matrix of this distribution is γ * I, where I is the identity matrix. The covariance matrix is the inverse of the precision matrix, i.e., (1/γ) * I.

source
ExponentialFamily.JointNormalType
JointNormal{D, S}

JointNormal is an auxilary structure used for the joint marginal over Normally distributed variables. JointNormal stores a vector with the original dimensionalities (ds), so statistics can later be re-separated.

Use ExponentialFamily.getcomponent(joint, index) to get a specific component of the joint distribution.

Fields

  • dist: joint distribution (typically just a big MvNormal distribution, but maybe a tuple of individual means and covariance matrices)
  • ds: a tuple with the original dimensionalities of individual Normal distributions
  • ds[k] = (n,) where n is an integer indicates Multivariate normal of size n
  • ds[k] = () indicates Univariate normal
source
ExponentialFamily.WishartFastType
WishartFast{T <: Real, A <: AbstractMatrix{T}} <: ContinuousMatrixDistribution

The WishartFast struct represents a fast version of the Wishart distribution. It is similar to the Wishart distribution from Distributions.jl, but it does not check input arguments, allowing the creation of improper Wishart messages.

For model creation and regular usage, it is recommended to use Wishart from Distributions.jl. The WishartFast distribution is intended for internal purposes and should not be directly used by regular users.

Fields

  • ν::T: The degrees of freedom parameter of the Wishart distribution.
  • invS::A: The inverse scale matrix parameter of the Wishart distribution.

Note

Internally, WishartFast stores and creates the inverse of its scale matrix. However, the params() function returns the scale matrix itself for backward compatibility. This is done to ensure better stability in the message passing update rules for ReactiveMP.jl.

source
ExponentialFamily.InverseWishartFastType
InverseWishartFast{T <: Real, A <: AbstractMatrix{T}} <: ContinuousMatrixDistribution

The InverseWishartFast struct represents an improper Inverse Wishart distribution. It is similar to the InverseWishart distribution from Distributions.jl, but it does not check input arguments, allowing the creation of improper InverseWishart messages.

For model creation and regular usage, it is recommended to use InverseWishart from Distributions.jl. The InverseWishartFast distribution is intended for internal purposes and should not be directly used by regular users.

Fields

  • ν::T: The degrees of freedom parameter of the inverse Wishart distribution.
  • S::A: The scale matrix parameter of the inverse Wishart distribution.

Note

The InverseWishartFast distribution does not enforce input argument validation, making it suitable for specialized cases where improper message constructions are needed.

source
ExponentialFamily.NormalGammaType
NormalGamma{T <: Real} <: ContinuousMultivariateDistribution

A normal-gamma distribution, where T is a real number. This distribution is a joint distribution of a normal random variable with mean μ and precision λ, and a gamma-distributed random variable with shape α and rate β.

Fields

  • μ::T: The mean of the normal distribution.
  • λ::T: The precision of the normal distribution.
  • α::T: The shape parameter of the gamma distribution.
  • β::T: The rate parameter of the gamma distribution.
source
ExponentialFamily.MvNormalWishartType
MvNormalWishart{T, M <: AbstractArray{T}, V <: AbstractMatrix{T}, K <: Real, N <: Real} <: ContinuousMatrixDistribution

A multivariate normal-Wishart distribution, where T is the element type of the arrays M and matrices V, and K and N are real numbers. This distribution is a joint distribution of a multivariate normal random variable with mean μ and a Wishart-distributed random matrix with scale matrix Ψ, degrees of freedom ν, and the scalar κ as a scaling parameter.

Fields

  • μ::M: The mean vector of the multivariate normal distribution.
  • Ψ::V: The scale matrix of the Wishart distribution.
  • κ::K: The scaling parameter of the Wishart distribution.
  • ν::N: The degrees of freedom of the Wishart distribution
source
ExponentialFamily.DirichletCollectionType
DirichletCollection{T <: Real, N, A <: AbstractArray{T, N}} <: Distribution{ArrayLikeVariate{N}, Continuous}

A collection of independent Dirichlet distributions, where T is the element type of the tensor A. The distribution generalizes the Dirichlet distribution to handle multiple sets of parameters organized in a tensor structure. This distribution collects multiple independent Dirichlet distributions into a single efficient interface. The Dirichlet counts for the independent Dirichlet distributions are stored along the first dimension of a. This distribution can be used as a conjugate prior to a Categorical distribution with mulitple switch cases (such as a discrete state-transition with controls).

Fields

  • α::A: The tensor parameter of the distribution, where each slice represents parameters of a Dirichlet distribution
  • α0::A: The sum of parameters along the first dimension.
  • lmnB::A: The log multinomial beta function values for each slice.

The distribution models multiple independent Dirichlet distributions organized in a tensor structure, where each slice a[:,i,j,...] represents the parameters of an independent Dirichlet distribution.

source