docstr: Given a dataset, finds the best parameters using the settings in the class
docstr_tok: ["Given","a","dataset",",","finds","the","best","parameters","using","the","settings","in","the","class"]
code: def find_best_parameters(self, data: pd.DataFrame):
      """
      Given a dataset, finds the best parameters using the settings in the class
      """
  
      if not self.seasonality:
          if self.verbose >= 1:
              print("Building a Non Seasonal Model...")
              print("\nFinding best Non Seasonal Parameters:")
          # TODO: Check if we need to also pass the exogenous variables here and
          # change the functionality of find_best_pdq_or_PDQ to incorporate these
          # exogenoug variables.
          (
              self.best_p,
              self.best_d,
              self.best_q,
              best_bic,
              _,
          ) = find_best_pdq_or_PDQ(
              ts_df=data[self.original_target_col],
              scoring=self.scoring,
              p_max=self.p_max,
              d_max=self.d_max,
              q_max=self.q_max,
              non_seasonal_pdq=None,
              seasonal_period=None,
              seasonality=False,
              verbose=self.verbose,
          )
  
          if self.verbose >= 1:
              print(
                  "\nBest model is: Non Seasonal SARIMAX(%d,%d,%d), %s = %0.3f"
                  % (
                      self.best_p,
                      self.best_d,
                      self.best_q,
                      self.scoring,
                      best_bic,
                  )
              )
      else:
          if self.verbose >= 1:
              print(
                  colorful.BOLD
                  + "Building a Seasonal Model..."
                  + colorful.END
              )
              print(
                  colorful.BOLD
                  + "\n    Finding best Non-Seasonal pdq Parameters:"
                  + colorful.END
              )
          # TODO: Check if we need to also pass the exogenous variables here and
          # change the functionality of find_best_pdq_or_PDQ to incorporate these
          # exogenoug variables.
          (
              self.best_p,
              self.best_d,
              self.best_q,
              _,
              _,
          ) = find_best_pdq_or_PDQ(
              ts_df=data[self.original_target_col],
              scoring=self.scoring,
              p_max=self.p_max,
              d_max=self.d_max,
              q_max=self.q_max,
              non_seasonal_pdq=None,  # we need to figure this out ...
              seasonal_period=None,
              seasonality=False,  # setting seasonality = False for p, d, q
              verbose=self.verbose,
          )
  
          if self.verbose >= 1:
              print(
                  colorful.BOLD
                  + "\n    Finding best Seasonal PDQ Model Parameters:"
                  + colorful.END
              )
          # TODO: Check if we need to also pass the exogenous variables here and
          # change the functionality of find_best_pdq_or_PDQ to incorporate these
          # exogenoug variables.
          (
              self.best_P,
              self.best_D,
              self.best_Q,
              best_bic,
              self.seasonality,
          ) = find_best_pdq_or_PDQ(
              ts_df=data[self.original_target_col],
              scoring=self.scoring,
              p_max=self.p_max,
              d_max=self.d_max,
              q_max=self.q_max,
              non_seasonal_pdq=(
                  self.best_p,
                  self.best_d,
                  self.best_q,
              ),  # found previously ...
              seasonal_period=self.seasonal_period,  # passing seasonal period
              seasonality=True,  # setting seasonality = True for P, D, Q
              verbose=self.verbose,
          )
  
          if self.seasonality:
              if self.verbose >= 1:
                  print(
                      "\nBest model is a Seasonal SARIMAX(%d,%d,%d)*(%d,%d,%d,%d), %s = %0.3f"
                      % (
                          self.best_p,
                          self.best_d,
                          self.best_q,
                          self.best_P,
                          self.best_D,
                          self.best_Q,
                          self.seasonal_period,
                          self.scoring,
                          best_bic,
                      )
                  )
          else:
              if self.verbose >= 1:
                  print(
                      "\nEven though seasonality has been set to True, the best model is a Non Seasonal SARIMAX(%d,%d,%d)"
                      % (self.best_p, self.best_d, self.best_q)
                  )
  
file_path: Auto_TS/auto_ts/models/ar_based/build_sarimax.py
imports: import numpy
  import pandas
  from pandas.core.generic import NDFrame
  import matplotlib.pyplot
  from statsmodels.tsa.statespace.sarimax import SARIMAX
  from ..build_base import BuildBase
  from .build_arima_base import BuildArimaBase
  from ...utils import colorful, print_static_rmse, print_dynamic_rmse
  from ...models.ar_based.param_finder import find_best_pdq_or_PDQ
label_desc: Use image node_id 1 for calling the BuildSarimax obj's underlying member method code with example usage: obj.find_best_parameters(data) without return types