code: def create_pred_category(pred_cols, extra_pred_cols, df_cols):
      """Creates a dictionary of predictor categories.
  
      The keys are categories, and the values are the corresponding
      predictor names. For detail, see
      `~greykite.sklearn.estimator.base_silverkite_estimator.BaseSilverkiteEstimator.pred_category`
  
      Parameters
      ----------
      pred_cols : `list` [ `str` ]
          A full list of predictor names used in the model, including extra predictor names.
      extra_pred_cols : `list` [ `str` ]
          A list of extra predictors what are manually provided for the estimator class.
          In ``SilverkiteEstimator``, this is the ``extra_pred_cols``.
          In ``SimpleSilverkiteEstimator``, this is the combination of ``regressor_cols``
          and ``extra_pred_cols``.
      df_cols : `list` [ `str` ]
          The extra columns that are present in the input df.
          Columns that are in ``df_cols`` are not considered for categories other than regressors.
          Columns are considered as regressors only if they are in ``df_cols``.
  
      Returns
      -------
      pred_category : `dict`
          A dictionary of categories and predictors. For details, see
          `~greykite.sklearn.estimator.base_silverkite_estimator.BaseSilverkiteEstimator.pred_category`
      """
  
      if extra_pred_cols is None:
          extra_pred_cols = []
      extra_pred_cols = list(
          set(extra_pred_cols)
      )  # might have duplicates
      # SimpleSilverkiteEstimator and SilverkiteEstimator have different ways to specify
      # regressors and lagged regressors. The ``extra_pred_cols`` in this function
      # should have a super set of such columns.
      # Regressor columns are defined as columns that are in
      # ``df_cols`` and that are present either in ``extra_pred_cols`` directly
      # or via interaction terms.
      # Because all columns in ``regressor_cols`` are present in ``df_cols``,
      # these columns are not categorized to any other category.
      regressor_cols = [
          col
          for col in df_cols
          if col
          in [c for term in extra_pred_cols for c in term.split(":")]
      ]
      pred_category = {
          "intercept": [
              col for col in pred_cols if re.search(INTERCEPT, col)
          ],
          # Time feature names could be included in seasonality features.
          # We do not want to include pure seasonality features.
          # If a term does not include interaction, it need to include
          # time feature name but not seasonality regex.
          # This keeps "ct1" and excludes "cos1_ct1_yearly"
          # If a term includes interaction, then at least one of the
          # two sub-terms need to satisfy the condition above.
          # This keeps "ct1:is_weekend" and "ct1:cos1_ct1_yearly"
          # and excludes "is_weekend:cos1_ct1_yearly".
          "time_features": [
              col
              for col in pred_cols
              if (
                  (
                      re.search(":", col) is None
                      and re.search(
                          "|".join(
                              cst.TimeFeaturesEnum.__dict__[
                                  "_member_names_"
                              ]
                          ),
                          col,
                      )
                      and re.search(cst.SEASONALITY_REGEX, col) is None
                  )
                  or (
                      re.search(":", col)
                      and any(
                          [
                              re.search(
                                  "|".join(
                                      cst.TimeFeaturesEnum.__dict__[
                                          "_member_names_"
                                      ]
                                  ),
                                  subcol,
                              )
                              and re.search(
                                  cst.SEASONALITY_REGEX, subcol
                              )
                              is None
                              for subcol in col.split(":")
                          ]
                      )
                  )
              )
              and col not in regressor_cols
          ],
          "event_features": [
              col
              for col in pred_cols
              if cst.EVENT_PREFIX in col and col not in regressor_cols
          ],
          # the same logic as time features for trend features
          "trend_features": [
              col
              for col in pred_cols
              if (
                  (
                      re.search(":", col) is None
                      and re.search(cst.TREND_REGEX, col)
                      and re.search(cst.SEASONALITY_REGEX, col) is None
                  )
                  or (
                      re.search(":", col)
                      and any(
                          [
                              re.search(cst.TREND_REGEX, subcol)
                              and re.search(
                                  cst.SEASONALITY_REGEX, subcol
                              )
                              is None
                              for subcol in col.split(":")
                          ]
                      )
                  )
              )
              and col not in regressor_cols
          ],
          "seasonality_features": [
              col
              for col in pred_cols
              if re.search(cst.SEASONALITY_REGEX, col)
              and col not in regressor_cols
          ],
          "lag_features": [
              col
              for col in pred_cols
              if re.search(cst.LAG_REGEX, col)
              and col not in regressor_cols
          ],
          # only the supplied extra_pred_col that are also in pred_cols
          "regressor_features": [
              col
              for col in pred_cols
              if col in regressor_cols
              or any([x in regressor_cols for x in col.split(":")])
          ],
          "interaction_features": [
              col for col in pred_cols if re.search(":", col)
          ],
      }
      return pred_category
  
file_path: greykite/greykite/algo/common/col_name_utils.py
imports: import re
  from greykite.common import constants
label_desc: Use image node_id 7 for calling a global function with example usage: create_pred_category(pred_cols, extra_pred_cols, df_cols) and returns: pred_category