Source code for ngclearn.utils.density.mixture



[docs] class Mixture: ## General mixture structure """ Implements a general mixture model template/structure. Effectively, this is the parent class/template for mixtures of distributions. Args: K: the number of components/latent variables within this mixture model max_iter: the maximum number of iterations to fit parameters to data (Default = 50) """ def __init__(self, K, max_iter=50, **kwargs): self.K = K self.max_iter = max_iter
[docs] def init(self, X): ## model data-dependent initialization function pass
[docs] def calc_log_likelihood(self, X): ## log-likelihood calculation routine pass
[docs] def fit(self, X, tol=1e-3, verbose=False): ## outer fitting process pass
[docs] def update(self, X): ## inner/iterative adjustment/update step pass
[docs] def sample(self, n_samples, mode_j=-1): ## model sampling routine pass