class_docstr: Deep autoencoding Gaussian mixture model for anomaly detection (DAGMM).
  DAGMM combines an autoencoder with a Gaussian mixture model to model the distribution
  of the reconstruction errors. DAGMM jointly optimizes the parameters of the deep autoencoder
  and the mixture model simultaneously in an end-to-end fashion.
  
  - paper: `Bo Zong, Qi Song, Martin Renqiang Min, Wei Cheng, Cristian Lumezanu, Daeki Cho and Haifeng Chen.
    Deep Autoencoding Gaussian Mixture Model for Unsupervised Anomaly Detection. 2018.
    <https://openreview.net/forum?id=BJJLHbb0->`_.
code: def _get_anomaly_score(
      self,
      time_series: pd.DataFrame,
      time_series_prev: pd.DataFrame = None,
  ) -> pd.DataFrame:
      self.dagmm.eval()
      ts = (
          pd.concat((time_series_prev, time_series))
          if time_series_prev is None
          else time_series
      )
      data_loader = RollingWindowDataset(
          ts,
          target_seq_index=None,
          shuffle=False,
          flatten=False,
          n_past=self.sequence_length,
          n_future=0,
          batch_size=1,
      )
      test_energy = np.full((self.sequence_length, ts.shape[0]), np.nan)
  
      for i, (sequence, _, _, _) in enumerate(data_loader):
          sequence = torch.tensor(
              sequence, dtype=torch.float, device=self.device
          )
          enc, dec, z, gamma = self.dagmm(sequence.float())
          sample_energy, _ = self.dagmm.compute_energy(
              z, size_average=False
          )
          idx = (
              i % self.sequence_length,
              np.arange(i, i + self.sequence_length),
          )
          test_energy[idx] = sample_energy.cpu().data.numpy()
      test_energy = np.nanmean(test_energy, axis=0)
      return pd.DataFrame(
          test_energy[-len(time_series) :], index=time_series.index
      )
  
imports: import copy
  import random
  from typing import List
  import numpy
  import pandas
  from merlion.utils import TimeSeries
  from merlion.models.base import NormalizingConfig
  from merlion.models.anomaly.base import DetectorBase, DetectorConfig, MultipleTimeseriesDetectorMixin
  from merlion.post_process.threshold import AggregateAlarms
  from merlion.utils.misc import ProgressBar, initializer
  from merlion.models.utils.rolling_window_dataset import RollingWindowDataset
label_desc: Use image node_id 8 for calling the DAGMM obj's underlying member method code with example usage: obj._get_anomaly_score(time_series, time_series_prev) and returns: pd