code: def filter_hyperparameters(
      hyperparameters: Dict,
      column_types: Dict,
      config: Optional[Union[Dict, DictConfig]] = None,
      fit_called: Optional[bool] = False,
  ):
      """
      Filter out the hyperparameters that have no effect for HPO.
  
      Parameters
      ----------
      hyperparameters
          The hyperparameters to override the default config.
      column_types
          Dataframe's column types.
      config
          A config provided by users or from the previous training.
      fit_called
          Whether fit() has been called.
  
      Returns
      -------
      The filtered hyperparameters.
      """
      model_names_key = f"{MODEL}.names"
      keys_to_filter = []
  
      if model_names_key in hyperparameters:
          # If continuous training or config is provided, make sure models are in config.model.
          config = get_default_config(config)
          selected_model_names = []
          config_model_names = list(config.model.keys())
          config_model_names.remove("names")
          for name in hyperparameters[model_names_key]:
              if name in config_model_names:
                  selected_model_names.append(name)
          hyperparameters[model_names_key] = selected_model_names
          assert (
              len(selected_model_names) > 0
          ), f"hyperparameters['model.names'] {hyperparameters[model_names_key]} doesn't match any config model names {config_model_names}."
  
          # Filter models that are not in hyperparameters[model_names_key]
          # Avoid key not in config error when applying the overrides later.
          model_keys = [
              k for k in hyperparameters.keys() if k.startswith(MODEL)
          ]
          if model_keys and model_names_key in model_keys:
              model_keys.remove(model_names_key)
              for k in model_keys:
                  if (
                      k.split(".")[1]
                      not in hyperparameters[model_names_key]
                      and k not in keys_to_filter
                  ):
                      keys_to_filter.append(k)
  
          # Filter models whose data types are not detected.
          # Avoid sampling unused checkpoints, e.g., hf_text models for image classification, to run jobs,
          # which wastes resources and time.
          detected_data_types = get_detected_data_types(column_types)
          selected_model_names = []
          for model_name in hyperparameters[model_names_key]:
              model_config = config.model[model_name]
              if model_config.data_types:
                  model_data_status = [
                      d_type in detected_data_types
                      for d_type in model_config.data_types
                  ]
                  if not all(model_data_status):
                      keys_to_filter.append(f"{MODEL}.{model_name}")
                  else:
                      selected_model_names.append(model_name)
              else:  # keep the fusion model, which will be handled by select_model().
                  selected_model_names.append(model_name)
          hyperparameters[model_names_key] = selected_model_names
          assert (
              len(selected_model_names) > 0
          ), f"Model {hyperparameters[model_names_key]} can't handle the data with column types {column_types}"
  
      # Filter keys for continuous training.
      # Model and data processors would be reused.
      if fit_called:
          warnings.warn(
              "HPO while continuous training."
              "Hyperparameters related to Model and Data will NOT take effect."
              "We will filter them out from the search space."
          )
          keys_to_filter.extend([MODEL, DATA])
  
      for key in keys_to_filter:
          hyperparameters = {
              k: v
              for k, v in hyperparameters.items()
              if not k.startswith(key)
          }
  
      return hyperparameters
  
imports: import copy
  import logging
  import os
  import re
  import warnings
  from typing import Callable, Dict, List, Optional, Tuple, Union
  from omegaconf import DictConfig, OmegaConf
  from packaging import version
  from torch import nn
  from ..constants import AUTOMM, DATA, FT_TRANSFORMER, FUSION_TRANSFORMER, HF_MODELS, MODEL, REGRESSION, VALID_CONFIG_KEYS
  from ..presets import get_automm_presets, get_basic_automm_config
  from .data import get_detected_data_types
label_desc: Use image node_id 17 for calling a global function with example usage: filter_hyperparameters(hyperparameters, column_types, config, fit_called) and returns: hyperparameters