alibi_detect.models.gmm module

alibi_detect.models.gmm.gmm_energy(z, phi, mu, cov, L, log_det_cov, return_mean=True)[source]

Compute sample energy from Gaussian Mixture Model.

Parameters
  • z (tensorflow.Tensor) – Observations.

  • phi (tensorflow.Tensor) – Mixture component distribution weights.

  • mu (tensorflow.Tensor) – Mixture means.

  • cov (tensorflow.Tensor) – Mixture covariance.

  • L (tensorflow.Tensor) – Cholesky decomposition of cov.

  • log_det_cov (tensorflow.Tensor) – Log of the determinant of cov.

  • return_mean (bool) – Take mean across all sample energies in a batch.

Return type

Tuple[tensorflow.Tensor, tensorflow.Tensor]

Returns

  • sample_energy – The sample energy of the GMM.

  • cov_diag – The inverse sum of the diagonal components of the covariance matrix.

alibi_detect.models.gmm.gmm_params(z, gamma)[source]

Compute parameters of Gaussian Mixture Model.

Parameters
  • z (tensorflow.Tensor) – Observations.

  • gamma (tensorflow.Tensor) – Mixture probabilities to derive mixture distribution weights from.

Return type

Tuple[tensorflow.Tensor, tensorflow.Tensor, tensorflow.Tensor, tensorflow.Tensor, tensorflow.Tensor]

Returns

  • phi – Mixture component distribution weights.

  • mu – Mixture means.

  • cov – Mixture covariance.

  • L – Cholesky decomposition of cov.

  • log_det_cov – Log of the determinant of cov.