mixle.stats.bayes.multivariate_normal_gamma module¶
Multivariate (factorized) Normal-Gamma distribution over (mu, tau) for a vector of independent Gaussians with unknown means and precisions.
Each component i is an independent NormalGamma:
tau_i ~ Gamma(a_i, b_i), mu_i | tau_i ~ Gaussian(mu0_i, 1/(lam_i*tau_i))
- Data type: (Tuple[np.ndarray, np.ndarray]): A pair (mu, tau) of length-d
vectors; the log-density is the sum of the d univariate NormalGamma log-densities.
This is the conjugate prior used by the diagonal
DiagonalGaussianDistribution (see its prior=
argument) and the vectorized counterpart of NormalGamma. It is a parameter
prior: it is scored on (mu, tau) parameter pairs, not fit from data by EM.
- class MultivariateNormalGammaDistribution(mu, lam, a, b, name=None, prior=None)[source]
Bases:
SequenceEncodableProbabilityDistributionVector of independent NormalGamma distributions over per-component (mu_i, tau_i) pairs; conjugate prior for diagonal Gaussians.
- Parameters:
- get_parameters()[source]
Returns the parameter tuple (mu, lam, a, b) of vectors.
- set_parameters(value)[source]
Set the parameters from a tuple of vectors.
- Parameters:
value – Tuple (mu, lam, a, b) of length-d arrays.
- Return type:
None
- cross_entropy(dist)[source]
Cross-entropy H(self, dist) = -E_self[log dist], summed over components, for a MultivariateNormalGamma argument.
- Parameters:
dist (MultivariateNormalGammaDistribution)
- Return type:
- density(x)[source]
Density at x = (mu, tau); see log_density().
- log_density(x)[source]
Log-density at x = (mu, tau), summed over the d components.
- Parameters:
x (FlexDatumType) – Tuple (mu, tau) of length-d vectors with tau_i > 0.
- Returns:
Log-density at x.
- Return type:
- seq_log_density(x)[source]
Vectorized log-density over a sequence of (mu, tau) pairs.
- Return type:
- sampler(seed=None)[source]
Create a MultivariateNormalGammaSampler for this distribution.
- Parameters:
seed (int | None)
- Return type:
MultivariateNormalGammaSampler
- estimator(pseudo_count=None)[source]
MultivariateNormalGamma is a parameter prior; not fit from data by EM.
- Parameters:
pseudo_count (float | None)
- Return type:
ParameterEstimator
- dist_to_encoder()[source]
Returns a MultivariateNormalGammaDataEncoder for encoding (mu, tau) pairs.
- Return type:
MultivariateNormalGammaDataEncoder