vbvarsel.elbo

Classes

ELBO_Computation

A class to contain the Evidence Lower Bound (ELBO) computation.

Module Contents

class vbvarsel.elbo.ELBO_Computation[source]

A class to contain the Evidence Lower Bound (ELBO) computation.

This class has no attributes, aside from Python’s built-ins, and contains only methods, the majority of which are private.

_ln_pi(alphaK, k)[source]

Private method to calculate Pi natural log.

Params
alphaK: np.ndarray

Calculated variational Paramter alphaK

k: int

The Kth target cluster

Returns: float

Calculated ln(π)

_ln_precision(akj, B)[source]

Private method for calculating precision natural log.

Params
akj: float

Calculated variational parameter Alphakj

B: np.ndarray

Calculated variational parameter B

Returns: np.ndarray

Calculated precision natural log

_log_resp_annealed(exp_ln_tau, exp_ln_sigma, f0, N, K, C, T)[source]

Private function to calculate log resp annealed.

Params
exp_ln_tau: list

Expected ln(tau) array

exp_ln_sigma: np.ndarray

Expected ln(sigma) array

f0: np.ndarray

Calculated f0 value

N: int

The Nth observation

K: int

The Kth cluster

C: np.ndarray

Calculated variational parameter C, the Covariate selection indicators

T: float

The annealing temperature

Returns
log_resp: np.ndarray

array of calculated values

_ln_delta_annealed(C, j, d, T)[source]

Private function to calculate the annealed value of delta natural log.

Params
C: np.ndarray

Covariate selection indicators

j: int

Iteration count

d: np.ndarray

Shape parameter of the Beta distribution on the probability.

T: float

The annealing temperature

Returns
ln_delta_ann: np.ndarray

calculated array of natural log of annealed delta values

_ln_delta_minus_annealed(C, j, d, T)[source]

Private function to calculate the minus of annealed delta natural log.

Params
C: np.ndarray

Covariate selection indicators

j: int

Iteration count

d: np.ndarray

Shape parameter of the Beta distribution on the probability.

T: float

The annealing temperature

Returns
ln_delta_ann_minus: np.ndarray

calculated array of natural log of annealed delta values

_entropy_wishart(k, j, b, a)[source]

Private function to calculate wishart entropy.

Params
K: int

The Kth cluster of the observation

j: int

Iteration count

b: np.ndarray

calculated value for variational parameter, betakj

a: float

calculated value for variational parameter, alphakj

Returns
e_w: np.ndarray

array of entropy wishart values

compute(XDim, K, N, C, Z, d, delta, beta, beta0, alpha, alpha0, a, a0, b, b0, m, m0, exp_ln_tau, exp_ln_sigma, f0, T=1) float[source]

Function to compute the Evidence Lower Bound (ELBO). The ELBO is the useful lower-bound on the log-likelihood of observed data.

Params
XDim: int

Number of variables (columns)

K: int

The Kth cluster of the observation

N: int

The Nth observation

C: np.ndarray

Covariate selection indicators

Z: np.ndarray

cluster assignment matrix

d: np.ndarray

Shape parameter of the Beta distribution on the probability.

delta: int

Calculated variational parameter, delta

beta: np.ndarray

Calculated variational parameter, betakj

beta0: float

Shrinkage parameter of the Gaussian conditional prior on the cluster means

alpha: np.ndarray

Calculated variational parameter, alphak

alpha0: float

Prior coefficient count

a: float

Calculated variational parameter, alphakj

a0: np.ndarray

Degrees of freedom for the Gamma prior on the cluster precision

b: np.ndarray

Calculated variational parameter, B

b0: np.ndarray

Prior covariance

m: np.ndarray

Calculated variational parameter, m

m0: np.ndarray

Prior mean

exp_ln_tau: list

expected ln(tau) array

exp_ln_sigma: np.ndarray

expected ln(sigma) array

f0: np.ndarray

Calculated variational parameter, f0

T: float

The annealing temperature

Returns:

float

Calculated ELBO value

Return type:

elbo