code: def set_output_feature_metric(base_config):
      """If single output feature, set trainer and hyperopt metric and goal for that feature if not set."""
      if len(base_config["output_features"]) != 1:
          # If multiple output features, ludwig uses the goal of minimizing combined loss;
          # this could be revisited/refined in the future.
          return base_config
      output_name = base_config["output_features"][0][NAME]
      output_type = base_config["output_features"][0][TYPE]
      output_metric = (
          get_output_type_registry()[output_type]
          .get_schema_cls()
          .default_validation_metric
      )
      output_goal = get_metric_objective(output_metric)
      if (
          "validation_field" not in base_config[TRAINER]
          and "validation_metric" not in base_config[TRAINER]
      ):
          base_config[TRAINER]["validation_field"] = output_name
          base_config[TRAINER]["validation_metric"] = output_metric
      if (
          "output_feature" not in base_config[HYPEROPT]
          and "metric" not in base_config[HYPEROPT]
          and "goal" not in base_config[HYPEROPT]
      ):
          base_config[HYPEROPT]["output_feature"] = output_name
          base_config[HYPEROPT]["metric"] = output_metric
          base_config[HYPEROPT]["goal"] = output_goal
      return base_config
  
file_path: ludwig/ludwig/utils/automl/utils.py
imports: import bisect
  import logging
  from typing import Dict
  from numpy import nan_to_num
  from pandas import Series
  from ludwig.api_annotations import DeveloperAPI
  from ludwig.constants import BINARY, CATEGORY, COMBINER, CONFIG, HYPEROPT, IMBALANCE_DETECTION_RATIO, NAME, NUMBER, PARAMETERS, SEARCH_ALG, TRAINER, TYPE
  from ludwig.features.feature_registries import get_output_type_registry
  from ludwig.modules.metric_registry import get_metric_objective
  from ludwig.schema.combiners.utils import get_combiner_jsonschema
label_desc: Use image node_id 7 for calling a global function with example usage: set_output_feature_metric(base_config) and returns: base_config, base_config