code: def _min_label_position(
      name: str = MIN_LABEL_POSITION_NAME,
      label_key: Optional[str] = None,
      eval_config: Optional[config_pb2.EvalConfig] = None,
      model_names: Optional[List[str]] = None,
      output_names: Optional[List[str]] = None,
      example_weighted: bool = False,
      query_key: str = "",
  ) -> metric_types.MetricComputations:
      """Returns metric computations for min label position."""
      if not query_key:
          raise ValueError(
              "a query_key is required to use MinLabelPosition metric"
          )
      if model_names is None:
          model_names = [""]
      if output_names is None:
          output_names = [""]
      keys = []
      computations = []
      preprocessors = None
      if label_key:
          preprocessors = [
              metric_types.FeaturePreprocessor(feature_keys=[label_key])
          ]
      for model_name in model_names:
          for output_name in output_names:
              key = metric_types.MetricKey(
                  name=name,
                  model_name=model_name,
                  output_name=output_name,
                  example_weighted=example_weighted,
              )
              keys.append(key)
              computations.append(
                  metric_types.MetricComputation(
                      keys=[key],
                      preprocessors=preprocessors,
                      combiner=_MinLabelPositionCombiner(
                          key, eval_config, example_weighted, label_key
                      ),
                  )
              )
      return computations
  
file_path: model-analysis/tensorflow_model_analysis/metrics/min_label_position.py
imports: from typing import Dict, Iterable, List, Optional
  import apache_beam
  import numpy
  from tensorflow_model_analysis.metrics import metric_types
  from tensorflow_model_analysis.metrics import metric_util
  from tensorflow_model_analysis.proto import config_pb2
  from tensorflow_model_analysis.utils import util
label_desc: Use image node_id 1 for calling a global function with example usage: _min_label_position(name, label_key, eval_config, model_names, output_names, example_weighted, query_key) and returns: computations