code: def describe(self):
      anom_bds = []
      anom_locs = []
      anom_in_trainval = []
      for ts, md in self:
          boundaries = md.anomaly.iloc[1:] != md.anomaly.values[:-1]
          boundaries = boundaries[boundaries].index
          if len(boundaries) == 0:
              continue
  
          ts_len = ts.index[-1] - ts.index[0]
          if md.anomaly.iloc[0]:
              anom_bds.append((ts.index[0], boundaries[0]))
              anom_locs.append((boundaries[0] - ts.index[0]) / ts_len)
              anom_in_trainval.append(True)
  
          for t0, tf in zip(boundaries[:-1], boundaries[1:]):
              if md.anomaly[t0]:
                  anom_bds.append((t0, tf))
                  anom_locs.append((tf - ts.index[0]) / ts_len)
                  anom_in_trainval.append(bool(md.trainval[t0]))
  
          if md.anomaly[boundaries[-1]]:
              anom_bds.append((boundaries[-1], ts.index[-1]))
              anom_locs.append(1.0)
              anom_in_trainval.append(False)
  
      print("=" * 80)
      print(
          f"Time series in dataset have average length {int(np.mean([len(ts) for ts, md in self]))}."
      )
      print(
          f"Time series in dataset have {len(anom_bds) / len(self):.1f} anomalies on average."
      )
      print(
          f"{sum(anom_in_trainval) / len(anom_in_trainval) * 100:.1f}% of "
          f"anomalies are in the train/val split of their respective time "
          f"series."
      )
      print(
          f"Anomalies in dataset have average length {pd.Timedelta(np.mean([(tf - t0) for t0, tf in anom_bds]))}."
      )
      print(
          f"Average anomaly occurs {np.mean(anom_locs) * 100:.1f}% "
          f"(+/- {np.std(anom_locs) * 100:.1f}%) of the way through "
          f"its respective time series."
      )
      print("=" * 80)
  
file_path: merlion/ts_datasets/ts_datasets/anomaly/base.py
imports: import numpy
  import pandas
  from ts_datasets.base import BaseDataset, _main_fns_docstr
label_desc: Use image node_id 3 for calling the TSADBaseDataset obj's underlying member method code with example usage: obj.describe() without return types