code: def test_make_hits_fn(self):
      with tf.Graph().as_default():
          scores = [[1.0, 3.0, 2.0], [1.0, 2.0, 3.0]]
          # Note that scores are ranked in descending order.
          # ranks = [[3, 1, 2], [3, 2, 1]]
          labels = [[0.0, 0.0, 1.0], [0.0, 1.0, 1.0]]
          # Note that the definition of Hits considers an item relevant
          # if its label is >= 1.0.
          weights = [[1.0, 2.0, 3.0], [4.0, 5.0, 6.0]]
          num_queries = len(scores)
          weights_feature_name = "weights"
          features = {weights_feature_name: weights}
          m = metrics_lib.make_ranking_metric_fn(
              metrics_lib.RankingMetricKey.HITS
          )
          m_2 = metrics_lib.make_ranking_metric_fn(
              metrics_lib.RankingMetricKey.HITS, topn=1
          )
          m_w = metrics_lib.make_ranking_metric_fn(
              metrics_lib.RankingMetricKey.HITS,
              topn=1,
              weights_feature_name=weights_feature_name,
          )
  
          self._check_metrics(
              [
                  (m([labels[0]], [scores[0]], features), 1.0),
                  (
                      m_2(labels, scores, features),
                      ((0.0 + 1.0) / num_queries),
                  ),
                  (
                      m_w(labels, scores, features),
                      (3.0 * 0.0 + (6.0 + 5.0) / 2.0 * 1.0)
                      / (3.0 + (6.0 + 5.0) / 2.0),
                  ),
              ]
          )
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import functools
  import math
  import tensorflow
  from tensorflow_ranking.python import metrics
label_desc: Use image node_id 5 for calling the MetricsTest obj's underlying member method code with example usage: obj.test_make_hits_fn() without return types