GaussianMixtureModel#
- class jolideco.priors.GaussianMixtureModel(means, covariances, weights, precisions_cholesky, meta=None)[source]#
Bases:
Module
Gaussian mixture model
- means#
Means
- Type:
~torch.Tensor
- covariances#
Covariances
- Type:
~torch.Tensor
- weights#
Weights
- Type:
~torch.Tensor
- precisions_cholesky#
Precision matrices
- Type:
~torch.Tensor
- meta#
Meta data
- Type:
GaussianMixtureModelMeta
Initialize internal Module state, shared by both nn.Module and ScriptModule.
Attributes Summary
Covariance determinant
Covariances (~numpy.ndarray)
Eigen images
Precision matrices pytorch
Compute the log-det of the cholesky decomposition of matrices
Log weights (~numpy.ndarray)
Weights (~numpy.ndarray)
Means (~numpy.ndarray)
Precision matrices pytorch
Number of features
Number of features
Patch shape (tuple)
Pixel weights
Pixel weights
Precisions Cholesky (~numpy.ndarray)
Weights (~numpy.ndarray)
Methods Summary
Compute log likelihood for given feature vector
Compute log likelihood for given feature vector
from_dict
(data)Create from dict
from_numpy
(means, covariances, weights[, meta])Gaussian mixture model
from_registry
(name, **kwargs)Create GMM from registry
from_sklearn_gmm
(gmm)Create from sklearn GMM
is_equal
(other)kl_divergence
(other)Compute KL divergence with respect to another GMM"
plot_eigen_images
([ncols, figsize])Plot images
plot_mean_images
([ncols, figsize])Plot mean images
read
(filename[, format])Read from matlab file
symmetric_kl_divergence
(other)Symmetric KL divergence
to_dict
()To dict
Attributes Documentation
- covariance_det#
Covariance determinant
- covariances_numpy#
Covariances (~numpy.ndarray)
- eigen_images#
Eigen images
- log_det_cholesky#
Precision matrices pytorch
- log_det_cholesky_numpy#
Compute the log-det of the cholesky decomposition of matrices
- log_weights#
Log weights (~numpy.ndarray)
- log_weights_numpy#
Weights (~numpy.ndarray)
- means_numpy#
Means (~numpy.ndarray)
- means_precisions_cholesky#
Precision matrices pytorch
- n_components#
Number of features
- n_features#
Number of features
- patch_shape#
Patch shape (tuple)
- pixel_weights#
Pixel weights
- pixel_weights_numpy#
Pixel weights
- precisions_cholesky_numpy#
Precisions Cholesky (~numpy.ndarray)
- weights_numpy#
Weights (~numpy.ndarray)
Methods Documentation
- classmethod from_dict(data)[source]#
Create from dict
- Parameters:
data (dict) – Data dictionary
- Returns:
gmm – Gaussian mixture model
- Return type:
~GaussianMixtureModel
- classmethod from_numpy(means, covariances, weights, meta=None)[source]#
Gaussian mixture model
- Parameters:
means (~numpy.ndarray) – Means
covariances (~numpy.ndarray) – Covariances
weights (~numpy.ndarray) – Weights
meta (GaussianMixtureModelMeta) – Meta data
- Returns:
gmm – Gaussian mixture model.
- Return type:
GaussianMixtureModel
- classmethod from_registry(name, **kwargs)[source]#
Create GMM from registry
- Parameters:
name (str) – Name of the registered GMM.
- Returns:
gmm – Gaussian mixture model.
- Return type:
GaussianMixtureModel
- kl_divergence(other)[source]#
Compute KL divergence with respect to another GMM”
See https://mr-easy.github.io/2020-04-16-kl-divergence-between-2-gaussian-distributions/
- Parameters:
other (~GaussianMixtureModel) – Other GMM
- Returns:
value – KL divergence
- Return type: