code: def testEvaluateWithJackknifeAndDiffMetrics(self):
      model_dir, baseline_dir = (
          self._getExportDir(),
          self._getBaselineDir(),
      )
      eval_shared_model = self._build_keras_model(
          "candidate", model_dir, mul=0
      )
      baseline_eval_shared_model = self._build_keras_model(
          "baseline", baseline_dir, mul=1
      )
  
      options = config_pb2.Options()
      options.compute_confidence_intervals.value = True
      options.confidence_intervals.method = (
          config_pb2.ConfidenceIntervalOptions.JACKKNIFE
      )
  
      eval_config = config_pb2.EvalConfig(
          model_specs=[
              config_pb2.ModelSpec(
                  name="candidate",
                  label_key="label",
                  example_weight_key="example_weight",
              ),
              config_pb2.ModelSpec(
                  name="baseline",
                  label_key="label",
                  example_weight_key="example_weight",
                  is_baseline=True,
              ),
          ],
          slicing_specs=[config_pb2.SlicingSpec()],
          metrics_specs=metric_specs.specs_from_metrics(
              [
                  calibration.MeanLabel("mean_label"),
                  calibration.MeanPrediction("mean_prediction"),
              ],
              model_names=["candidate", "baseline"],
          ),
          options=options,
      )
  
      eval_shared_models = {
          "candidate": eval_shared_model,
          "baseline": baseline_eval_shared_model,
      }
  
      schema = text_format.Parse(
          """
          tensor_representation_group {
            key: ""
            value {
              tensor_representation {
                key: "input_1"
                value {
                  dense_tensor {
                    column_name: "input_1"
                    shape { dim { size: 1 } }
                  }
                }
              }
            }
          }
          feature {
            name: "input_1"
            type: FLOAT
          }
          feature {
            name: "label"
            type: FLOAT
          }
          feature {
            name: "example_weight"
            type: FLOAT
          }
          feature {
            name: "extra_feature"
            type: BYTES
          }
          """,
          schema_pb2.Schema(),
      )
      tfx_io = test_util.InMemoryTFExampleRecord(
          schema=schema,
          raw_record_column_name=constants.ARROW_INPUT_COLUMN,
      )
      tensor_adapter_config = tensor_adapter.TensorAdapterConfig(
          arrow_schema=tfx_io.ArrowSchema(),
          tensor_representations=tfx_io.TensorRepresentations(),
      )
  
      examples = [
          self._makeExample(
              input_1=0.0,
              label=1.0,
              example_weight=1.0,
              extra_feature="non_model_feature",
          ),
          self._makeExample(
              input_1=1.0,
              label=0.0,
              example_weight=0.5,
              extra_feature="non_model_feature",
          ),
      ]
  
      extractors = [
          features_extractor.FeaturesExtractor(
              eval_config=eval_config,
              tensor_representations=tensor_adapter_config.tensor_representations,
          ),
          labels_extractor.LabelsExtractor(eval_config),
          example_weights_extractor.ExampleWeightsExtractor(
              eval_config
          ),
          predictions_extractor.PredictionsExtractor(
              eval_shared_model=eval_shared_models,
              eval_config=eval_config,
          ),
          unbatch_extractor.UnbatchExtractor(),
          slice_key_extractor.SliceKeyExtractor(
              eval_config=eval_config
          ),
      ]
      evaluators = [
          metrics_plots_and_validations_evaluator.MetricsPlotsAndValidationsEvaluator(
              eval_config=eval_config,
              eval_shared_model=eval_shared_models,
          )
      ]
  
      with beam.Pipeline() as pipeline:
          # pylint: disable=no-value-for-parameter
          metrics = (
              pipeline
              | "Create"
              >> beam.Create(
                  [e.SerializeToString() for e in examples * 1000]
              )
              | "BatchExamples" >> tfx_io.BeamSource()
              | "InputsToExtracts"
              >> model_eval_lib.BatchedInputsToExtracts()
              | "ExtractAndEvaluate"
              >> model_eval_lib.ExtractAndEvaluate(
                  extractors=extractors, evaluators=evaluators
              )
          )
  
          # pylint: enable=no-value-for-parameter
  
          def check_metrics(got):
              try:
                  self.assertLen(got, 1)
                  got_slice_key, got_metrics = got[0]
                  self.assertEqual(got_slice_key, ())
                  # check only the diff metrics.
                  weighted_example_count_key = metric_types.MetricKey(
                      name="weighted_example_count",
                      model_name="candidate",
                      is_diff=True,
                      example_weighted=True,
                  )
                  prediction_key = metric_types.MetricKey(
                      name="mean_prediction",
                      model_name="candidate",
                      is_diff=True,
                      example_weighted=True,
                  )
                  label_key = metric_types.MetricKey(
                      name="mean_label",
                      model_name="candidate",
                      is_diff=True,
                      example_weighted=True,
                  )
                  self.assertDictElementsWithTDistributionAlmostEqual(
                      got_metrics,
                      {
                          weighted_example_count_key: 0,
                          label_key: 0,
                          prediction_key: 0
                          - (0 * 1 + 1 * 0.5) / (1 + 0.5),
                      },
                  )
  
              except AssertionError as err:
                  raise util.BeamAssertException(err)
  
          util.assert_that(
              metrics[constants.METRICS_KEY], check_metrics
          )
  
imports: import os
  from absl.testing import parameterized
  import apache_beam
  from apache_beam.testing import util
  import numpy
  import tensorflow
  from tensorflow_model_analysis import constants
  from tensorflow_model_analysis.addons.fairness.metrics import lift
  from tensorflow_model_analysis.api import model_eval_lib
  from tensorflow_model_analysis.eval_saved_model import testutil
  from tensorflow_model_analysis.eval_saved_model.example_trainers import dnn_classifier
  from tensorflow_model_analysis.eval_saved_model.example_trainers import fixed_prediction_estimator_extra_fields
  from tensorflow_model_analysis.eval_saved_model.example_trainers import linear_classifier
  from tensorflow_model_analysis.eval_saved_model.example_trainers import multi_head
  from tensorflow_model_analysis.evaluators import metrics_plots_and_validations_evaluator
  from tensorflow_model_analysis.extractors import example_weights_extractor
  from tensorflow_model_analysis.extractors import features_extractor
  from tensorflow_model_analysis.extractors import labels_extractor
  from tensorflow_model_analysis.extractors import legacy_predict_extractor
  from tensorflow_model_analysis.extractors import materialized_predictions_extractor
  from tensorflow_model_analysis.extractors import predictions_extractor
  from tensorflow_model_analysis.extractors import slice_key_extractor
  from tensorflow_model_analysis.extractors import unbatch_extractor
  from tensorflow_model_analysis.metrics import attributions
  from tensorflow_model_analysis.metrics import binary_confusion_matrices
  from tensorflow_model_analysis.metrics import calibration
  from tensorflow_model_analysis.metrics import calibration_plot
  from tensorflow_model_analysis.metrics import confusion_matrix_plot
  from tensorflow_model_analysis.metrics import metric_specs
  from tensorflow_model_analysis.metrics import metric_types
  from tensorflow_model_analysis.metrics import ndcg
  from tensorflow_model_analysis.post_export_metrics import metrics
  from tensorflow_model_analysis.proto import config_pb2
  from tensorflow_model_analysis.proto import validation_result_pb2
  from tfx_bsl.tfxio import raw_tf_record
  from tfx_bsl.tfxio import tensor_adapter
  from tfx_bsl.tfxio import test_util
  from google.protobuf import text_format
  from tensorflow_metadata.proto.v0 import schema_pb2
label_desc: Use image node_id 12 for calling the MetricsPlotsAndValidationsEvaluatorTest obj's underlying member method code with example usage: obj.testEvaluateWithJackknifeAndDiffMetrics() without return types