class_docstr: Base class of univariate detectors and transformers.
code: def _predict(
      self, ts: Union[pd.Series, pd.DataFrame]
  ) -> Union[pd.Series, pd.DataFrame]:
      if isinstance(ts, pd.Series):
          s = ts.copy()  # type: pd.Series
          if not isinstance(s.index, pd.DatetimeIndex):
              raise TypeError(
                  "Index of the input time series must be a pandas "
                  "DatetimeIndex object."
              )
          predicted = self._predict_core(s)
          # if a Series-to-Series operation, make sure Series name keeps
          if isinstance(predicted, pd.Series):
              predicted.name = ts.name
      elif isinstance(ts, pd.DataFrame):
          df = ts.copy()  # type: pd.DataFrame
          if df.columns.duplicated().any():
              raise ValueError(
                  "Input DataFrame must have unique column names."
              )
          # apply the model to each column
          predicted_all_cols = []
          for col in df.columns:
              predicted_this_col = self._predict(df[col])
              # if a Series-to-DF operation, update column name
              if isinstance(predicted_this_col, pd.DataFrame):
                  predicted_this_col = predicted_this_col.rename(
                      columns={
                          col1: "{}_{}".format(col, col1)
                          for col1 in predicted_this_col.columns
                      }
                  )
              predicted_all_cols.append(predicted_this_col)
          predicted = pd.concat(predicted_all_cols, axis=1)
      else:
          raise TypeError("Input must be a pandas Series or DataFrame.")
      # make sure index freq is the same (because pandas has a bug that some
      # operation, e.g. concat, may change freq)
      predicted.index.freq = ts.index.freq
      return predicted
  
imports: from abc import ABC, abstractmethod
  from copy import deepcopy
  from typing import Any, Dict, List, Tuple, Union
  import pandas
label_desc: Use image node_id 1 for calling the _NonTrainableUnivariateModel obj's underlying member method code with example usage: obj._predict(ts) and returns: predicted