docstr: AEGMM-based outlier detector.
  
  Parameters
  ----------
  threshold
      Threshold used for outlier score to determine outliers.
  aegmm
      A trained tf.keras model if available.
  encoder_net
      Layers for the encoder wrapped in a tf.keras.Sequential class if no 'aegmm' is specified.
  decoder_net
      Layers for the decoder wrapped in a tf.keras.Sequential class if no 'aegmm' is specified.
  gmm_density_net
      Layers for the GMM network wrapped in a tf.keras.Sequential class.
  n_gmm
      Number of components in GMM.
  recon_features
      Function to extract features from the reconstructed instance by the decoder.
  data_type
      Optionally specifiy the data type (tabular, image or time-series). Added to metadata.
docstr_tok: ["AEGMM-based","outlier","detector",".","Parameters","--","--","--","--","--","threshold","Threshold","used","for","outlier","score","to","determine","outliers",".","aegmm","A","trained","tf.keras","model","if","available",".","encoder_net","Layers","for","the","encoder","wrapped","in","a","tf.keras.Sequential","class","if","no","'aegmm","'","is","specified",".","decoder_net","Layers","for","the","decoder","wrapped","in","a","tf.keras.Sequential","class","if","no","'aegmm","'","is","specified",".","gmm_density_net","Layers","for","the","GMM","network","wrapped","in","a","tf.keras.Sequential","class",".","n_gmm","Number","of","components","in","GMM",".","recon_features","Function","to","extract","features","from","the","reconstructed","instance","by","the","decoder",".","data_type","Optionally","specifiy","the","data","type","(","tabular",",","image","or","time-series",")",".","Added","to","metadata","."]
code: def __init__(
      self,
      threshold: float = None,
      aegmm: tf.keras.Model = None,
      encoder_net: tf.keras.Model = None,
      decoder_net: tf.keras.Model = None,
      gmm_density_net: tf.keras.Model = None,
      n_gmm: int = None,
      recon_features: Callable = eucl_cosim_features,
      data_type: str = None,
  ) -> None:
      """
      AEGMM-based outlier detector.
  
      Parameters
      ----------
      threshold
          Threshold used for outlier score to determine outliers.
      aegmm
          A trained tf.keras model if available.
      encoder_net
          Layers for the encoder wrapped in a tf.keras.Sequential class if no 'aegmm' is specified.
      decoder_net
          Layers for the decoder wrapped in a tf.keras.Sequential class if no 'aegmm' is specified.
      gmm_density_net
          Layers for the GMM network wrapped in a tf.keras.Sequential class.
      n_gmm
          Number of components in GMM.
      recon_features
          Function to extract features from the reconstructed instance by the decoder.
      data_type
          Optionally specifiy the data type (tabular, image or time-series). Added to metadata.
      """
      super().__init__()
  
      if threshold is None:
          logger.warning(
              "No threshold level set. Need to infer threshold using `infer_threshold`."
          )
  
      self.threshold = threshold
  
      # check if model can be loaded, otherwise initialize AEGMM model
      if isinstance(aegmm, tf.keras.Model):
          self.aegmm = aegmm
      elif (
          isinstance(encoder_net, tf.keras.Sequential)
          and isinstance(decoder_net, tf.keras.Sequential)
          and isinstance(gmm_density_net, tf.keras.Sequential)
      ):
          self.aegmm = AEGMM(
              encoder_net,
              decoder_net,
              gmm_density_net,
              n_gmm,
              recon_features,
          )
      else:
          raise TypeError(
              "No valid format detected for `aegmm` (tf.keras.Model) "
              "or `encoder_net`, `decoder_net` and `gmm_density_net` (tf.keras.Sequential)."
          )
  
      # set metadata
      self.meta["detector_type"] = "outlier"
      self.meta["data_type"] = data_type
      self.meta["online"] = False
  
      self.phi, self.mu, self.cov, self.L, self.log_det_cov = (
          None,
          None,
          None,
          None,
          None,
      )
  
file_path: alibi-detect/alibi_detect/od/aegmm.py
imports: import logging
  import numpy
  import tensorflow
  from typing import Callable, Dict, Tuple
  from alibi_detect.models.tensorflow.autoencoder import AEGMM, eucl_cosim_features
  from alibi_detect.models.tensorflow.gmm import gmm_energy, gmm_params
  from alibi_detect.models.tensorflow.losses import loss_aegmm
  from alibi_detect.models.tensorflow.trainer import trainer
  from alibi_detect.base import BaseDetector, FitMixin, ThresholdMixin, outlier_prediction_dict
  from alibi_detect.utils.tensorflow.prediction import predict_batch
  from alibi_detect.utils._types import OptimizerTF
label_desc: Use image node_id 1 to create a new OutlierAEGMM object from inherited base classes: BaseDetector, FitMixin, ThresholdMixin with example: obj = OutlierAEGMM(threshold, aegmm, encoder_net, decoder_net, gmm_density_net, n_gmm, recon_features, data_type)