class_docstr: Abstract base class for combining the outputs of multiple models. Subclasses
  should implement the abstract method ``_combine_univariates``. All combiners
  are callable objects.
  
  .. automethod:: __call__
docstr: Applies the model combination rule to combine multiple model outputs.
  
  :param all_model_outs: a list of time series, with each time series
      representing the output of a single model.
  :param target: a target time series (e.g. labels)
  :return: a single time series of combined model outputs on this training data.
docstr_tok: ["Applies","the","model","combination","rule","to","combine","multiple","model","outputs",".",":","param","all_model_outs",":","a","list","of","time","series",",","with","each","time","series","representing","the","output","of","a","single","model",".",":","param","target",":","a","target","time","series","(","e.g",".","labels",")",":","return",":","a","single","time","series","of","combined","model","outputs","on","this","training","data","."]
code: def __call__(
      self,
      all_model_outs: List[TimeSeries],
      target: TimeSeries,
      _check_dim=True,
  ) -> TimeSeries:
      """
      Applies the model combination rule to combine multiple model outputs.
  
      :param all_model_outs: a list of time series, with each time series
          representing the output of a single model.
      :param target: a target time series (e.g. labels)
      :return: a single time series of combined model outputs on this training data.
      """
      if isinstance(target, list):
          new_all_model_outs = []
          for i, out in enumerate(all_model_outs):
              if out is None:
                  new_all_model_outs.append(out)
              else:
                  assert isinstance(out, list) and len(out) == len(
                      target
                  ), (
                      f"If target is a list of time series, each model output should be a "
                      f"list with the same length, but target has length {len(target)}, "
                      f"while model output {i} is a {type(out).__name__} of length {len(out)}"
                  )
                  new_all_model_outs.append(sum(out[1:], out[0]))
          target = sum(target[1:], target[0])
          all_model_outs = new_all_model_outs
  
      js = [
          j for j, out in enumerate(all_model_outs) if out is not None
      ]
      assert len(js) > 0, "`all_model_outs` cannot all be `None`"
      j = js[0]
      assert all(
          out.dim == all_model_outs[j].dim
          for out in all_model_outs
          if out is not None
      )
      if self.n_models is None:
          self.n_models = len(all_model_outs)
  
      models_used = self.models_used
      if len(all_model_outs) == self.n_models:
          j = 0
          all_model_outs = [
              x for x, used in zip(all_model_outs, models_used) if used
          ]
      elif len(all_model_outs) != sum(models_used):
          raise RuntimeError(
              f"Expected either {self.n_models} or {sum(models_used)} "
              f"model outputs, but got {len(all_model_outs)} model outputs "
              f"instead."
          )
  
      all_model_outs = _align_outputs(all_model_outs, target)
      if all(out is None for out in all_model_outs):
          return None
  
      combined = OrderedDict()
      for i in range(all_model_outs[j].dim):
          name = all_model_outs[j].names[i]
          all_i = [
              None if ts is None else ts.univariates[ts.names[i]]
              for ts in all_model_outs
          ]
          combined[name] = self._combine_univariates(all_i)
  
      return TimeSeries(combined)
  
imports: from abc import abstractmethod
  from collections import OrderedDict
  import copy
  import logging
  from typing import List, Optional, Union
  import numpy
  from merlion.evaluate.anomaly import TSADMetric
  from merlion.evaluate.forecast import ForecastMetric
  from merlion.utils import UnivariateTimeSeries, TimeSeries
  from merlion.utils.misc import AutodocABCMeta
label_desc: Use image node_id 14 for calling the CombinerBase obj's underlying member method code with example usage: obj.__call__(all_model_outs, target, _check_dim) and returns: TimeSeries, None