docstr: Return the predictions
docstr_tok: ["Return","the","predictions"]
code: def predict(
      self,
      testdata: Optional[pd.DataFrame] = None,
      forecast_period: Optional[int] = None,
      simple: bool = True,
  ) -> NDFrame:
      """
      Return the predictions
      """
      # Extract the dynamic predicted and true values of our time series
      if self.univariate:
          if isinstance(testdata, pd.DataFrame) or isinstance(
              testdata, pd.Series
          ):
              # use the forecast period used during training
              forecast_period = testdata.shape[0]
              self.forecast_period = testdata.shape[0]
      else:
          if testdata is None:
              raise ValueError(
                  "SARIMAX needs testdata to make predictions, but this was not provided. Please provide to proceed."
              )
              forecast_period = self.forecast_period
          elif isinstance(testdata, pd.DataFrame) or isinstance(
              testdata, pd.Series
          ):
              if forecast_period != testdata.shape[0]:
                  warnings.warn(
                      "Forecast Period is not equal to the number of observations in testdata. The forecast period will be assumed to be the number of observations in testdata."
                  )
              forecast_period = testdata.shape[0]
              self.forecast_period = forecast_period
              try:
                  testdata = testdata[self.original_preds]
              except Exception as e:
                  print(e)
                  print(
                      "Model was trained with train dataframe. Please make sure you are passing a test data frame."
                  )
                  return
          elif isinstance(testdata, int):
              if forecast_period != testdata:
                  print(
                      "Forecast Period is not equal to the number of observations in testdata. The forecast period will be assumed to be the number of observations in testdata."
                  )
  
              forecast_period = testdata
              self.forecast_period = forecast_period
  
      if self.univariate:
          res = self.model.get_forecast(self.forecast_period)
      else:
          if isinstance(testdata, pd.DataFrame) or isinstance(
              testdata, pd.Series
          ):
              res = self.model.get_forecast(
                  self.forecast_period, exog=testdata
              )
          else:
              try:
                  res = self.model.get_forecast(self.forecast_period)
              except Exception as e:
                  print(e)
                  print(
                      "Model was trained with train dataframe. Please make sure you are passing a test data frame."
                  )
                  return
  
      res_frame = res.summary_frame()
      res_frame.rename(columns={"mean": "yhat"}, inplace=True)
  
      if simple:
          res_frame = res_frame["yhat"]
          res_frame = (
              res_frame.squeeze()
          )  # Convert to a pandas series object
      else:
          # Pass as is
          pass
  
      return res_frame
  
imports: from typing import Optional
  import warnings
  from abc import abstractmethod
  import copy
  import pdb
  import numpy
  import pandas
  from pandas.core.generic import NDFrame
  import dask
  import dask.dataframe
  import matplotlib.pyplot
  from sklearn.model_selection import TimeSeriesSplit
  from statsmodels.tsa.statespace.sarimax import SARIMAX
  from ..build_base import BuildBase
  from ...utils import colorful, print_static_rmse, print_dynamic_rmse, print_ts_model_stats
  from ...models.ar_based.param_finder import find_best_pdq_or_PDQ
label_desc: Use image node_id 6 for calling the BuildArimaBase obj's underlying member method code with example usage: obj.predict(testdata, forecast_period, simple) and returns: res_frame