code: def update_confidence_type(
      component_config: Dict[Text, Any]
  ) -> Dict[Text, Any]:
      """Set model confidence to auto if margin loss is used.
  
      Option `auto` is reserved for margin loss type. It will be removed once margin loss
      is deprecated.
  
      Args:
          component_config: model configuration
  
      Returns:
          updated model configuration
      """
      if component_config[LOSS_TYPE] == MARGIN:
          rasa.shared.utils.io.raise_warning(
              f"Overriding defaults by setting {MODEL_CONFIDENCE} to "
              f"{AUTO} as {LOSS_TYPE} is set to {MARGIN} in the configuration. "
              f"This means that model's confidences will be computed "
              f"as cosine similarities. Users are encouraged to shift to "
              f"cross entropy loss by setting `{LOSS_TYPE}={CROSS_ENTROPY}`."
          )
          component_config[MODEL_CONFIDENCE] = AUTO
      return component_config
  
imports: from pathlib import Path
  import numpy
  from typing import Optional, Text, Dict, Any, Union, List, Tuple, TYPE_CHECKING
  import rasa.shared.utils.common
  import rasa.shared.utils.io
  import rasa.nlu.utils.bilou_utils
  from rasa.shared.constants import NEXT_MAJOR_VERSION_FOR_DEPRECATIONS
  from rasa.nlu.constants import NUMBER_OF_SUB_TOKENS
  import rasa.utils.io
  from rasa.utils.tensorflow.constants import LOSS_TYPE, RANKING_LENGTH, RENORMALIZE_CONFIDENCES, SIMILARITY_TYPE, EVAL_NUM_EXAMPLES, EVAL_NUM_EPOCHS, EPOCHS, SOFTMAX, MARGIN, AUTO, INNER, COSINE, SEQUENCE, CROSS_ENTROPY, CONSTRAIN_SIMILARITIES, MODEL_CONFIDENCE, TOLERANCE, CHECKPOINT_MODEL
  from rasa.utils.tensorflow.callback import RasaTrainingLogger, RasaModelCheckpoint
  from rasa.utils.tensorflow.data_generator import RasaBatchDataGenerator
  from rasa.utils.tensorflow.model_data import RasaModelData
  from rasa.shared.nlu.constants import SPLIT_ENTITIES_BY_COMMA
  from rasa.shared.exceptions import InvalidConfigException
label_desc: Use image node_id 12 for calling a global function with example usage: update_confidence_type(component_config) and returns: component_config