GaussianMixtureModel

class pycave.bayes.gmm.GaussianMixtureModel(config)[source]

Bases: Configurable[GaussianMixtureModelConfig], Module

PyTorch module for a Gaussian mixture model.

Covariances are represented via their Cholesky decomposition for computational efficiency. The model does not have trainable parameters.

Parameters:

config (GaussianMixtureModelConfig) -- The configuration to use for initializing the module's buffers.

Methods

forward

Computes the log-probability of observing each of the provided datapoints for each of the GMM's components.

reset_parameters

Resets the parameters of the GMM.

sample

Samples the provided number of datapoints from the GMM.

Inherited Methods

load

Loads the module's configurations and parameters from files in the specified directory at first.

save

Saves the module's configuration and parameters to files in the specified directory.

Attributes

covariances

The covariance matrices learnt for the GMM's components.

component_probs

The probabilities of each component, buffer of shape [num_components].

means

The means of each component, buffer of shape [num_components, num_features].

precisions_cholesky

The precision matrices for the components' covariances, buffer with a shape dependent on the covariance type, see CovarianceType.