code: def MaterializedPredictionsExtractor(
      eval_config: config_pb2.EvalConfig,
      output_keypath: Sequence[str] = (constants.PREDICTIONS_KEY,),
  ) -> extractor.Extractor:
      """Creates an extractor for rekeying preexisting predictions.
  
      The extractor's PTransform uses the config's ModelSpec.prediction_key(s)
      to lookup the associated prediction values stored as features under the
      tfma.FEATURES_KEY in extracts. The resulting values are then added to the
      extracts under the key tfma.PREDICTIONS_KEY.
  
      Args:
        eval_config: Eval config.
        output_keypath: A list of keys to be used as the path to traverse and insert
          the outputs in the extract.
  
      Returns:
        Extractor for rekeying preexisting predictions.
      """
      # pylint: disable=no-value-for-parameter
      return extractor.Extractor(
          stage_name=_MATERIALIZED_PREDICTIONS_EXTRACTOR_STAGE_NAME,
          ptransform=_ExtractMaterializedPredictions(
              eval_config=eval_config, output_keypath=output_keypath
          ),
      )
  
file_path: model-analysis/tensorflow_model_analysis/extractors/materialized_predictions_extractor.py
imports: from typing import Sequence
  import apache_beam
  from tensorflow_model_analysis import constants
  from tensorflow_model_analysis.api import types
  from tensorflow_model_analysis.extractors import extractor
  from tensorflow_model_analysis.proto import config_pb2
  from tensorflow_model_analysis.utils import model_util
  from tensorflow_model_analysis.utils import util
label_desc: Use image node_id 1 for calling a global function with example usage: MaterializedPredictionsExtractor(eval_config, output_keypath) and returns: extractor