docstr: Train AEGMM model.
  
  Parameters
  ----------
  X
      Training batch.
  loss_fn
      Loss function used for training.
  w_energy
      Weight on sample energy loss term if default `loss_aegmm` loss fn is used.
  w_cov_diag
      Weight on covariance regularizing loss term if default `loss_aegmm` loss fn is used.
  optimizer
      Optimizer used for training.
  epochs
      Number of training epochs.
  batch_size
      Batch size used for training.
  verbose
      Whether to print training progress.
  log_metric
      Additional metrics whose progress will be displayed if verbose equals True.
  callbacks
      Callbacks used during training.
docstr_tok: ["Train","AEGMM","model",".","Parameters","--","--","--","--","--","X","Training","batch",".","loss_fn","Loss","function","used","for","training",".","w_energy","Weight","on","sample","energy","loss","term","if","default","`","loss_aegmm","`","loss","fn","is","used",".","w_cov_diag","Weight","on","covariance","regularizing","loss","term","if","default","`","loss_aegmm","`","loss","fn","is","used",".","optimizer","Optimizer","used","for","training",".","epochs","Number","of","training","epochs",".","batch_size","Batch","size","used","for","training",".","verbose","Whether","to","print","training","progress",".","log_metric","Additional","metrics","whose","progress","will","be","displayed","if","verbose","equals","True",".","callbacks","Callbacks","used","during","training","."]
code: def fit(
      self,
      X: np.ndarray,
      loss_fn: tf.keras.losses = loss_aegmm,
      w_energy: float = 0.1,
      w_cov_diag: float = 0.005,
      optimizer: OptimizerTF = tf.keras.optimizers.Adam,
      epochs: int = 20,
      batch_size: int = 64,
      verbose: bool = True,
      log_metric: Tuple[str, "tf.keras.metrics"] = None,
      callbacks: tf.keras.callbacks = None,
  ) -> None:
      """
      Train AEGMM model.
  
      Parameters
      ----------
      X
          Training batch.
      loss_fn
          Loss function used for training.
      w_energy
          Weight on sample energy loss term if default `loss_aegmm` loss fn is used.
      w_cov_diag
          Weight on covariance regularizing loss term if default `loss_aegmm` loss fn is used.
      optimizer
          Optimizer used for training.
      epochs
          Number of training epochs.
      batch_size
          Batch size used for training.
      verbose
          Whether to print training progress.
      log_metric
          Additional metrics whose progress will be displayed if verbose equals True.
      callbacks
          Callbacks used during training.
      """
      # train arguments
      args = [self.aegmm, loss_fn, X]
      optimizer = (
          optimizer() if isinstance(optimizer, type) else optimizer
      )
      kwargs = {
          "optimizer": optimizer,
          "epochs": epochs,
          "batch_size": batch_size,
          "verbose": verbose,
          "log_metric": log_metric,
          "callbacks": callbacks,
          "loss_fn_kwargs": {
              "w_energy": w_energy,
              "w_cov_diag": w_cov_diag,
          },
      }
  
      # train
      trainer(*args, **kwargs)
  
      # set GMM parameters
      x_recon, z, gamma = self.aegmm(X)
      (
          self.phi,
          self.mu,
          self.cov,
          self.L,
          self.log_det_cov,
      ) = gmm_params(z, gamma)
  
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 2 for calling the OutlierAEGMM obj's underlying member method code with example usage: obj.fit(X, loss_fn, w_energy, w_cov_diag, optimizer, epochs, batch_size, verbose, log_metric, callbacks) without return types