alibi_detect.models.tensorflow.gmm module

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

Compute sample energy from Gaussian Mixture Model.

Parameters:
  • z (Tensor) – Observations.

  • phi (Tensor) – Mixture component distribution weights.

  • mu (Tensor) – Mixture means.

  • cov (Tensor) – Mixture covariance.

  • L (Tensor) – Cholesky decomposition of cov.

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

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

Return type:

Tuple[Tensor, 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.tensorflow.gmm.gmm_params(z, gamma)[source]

Compute parameters of Gaussian Mixture Model.

Parameters:
  • z (Tensor) – Observations.

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

Return type:

Tuple[Tensor, Tensor, Tensor, Tensor, 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.