class_docstr: Mean reciprocal rank (MRR).
  
  For each list of scores `s` in `y_pred` and list of labels `y` in `y_true`:
  
  ```
  MRR(y, s) = max_i y_i / rank(s_i)
  ```
  
  NOTE: This metric converts graded relevance to binary relevance by setting
  `y_i = 1` if `y_i >= 1`.
  
  Standalone usage:
  
  >>> y_true = [[0., 1., 1.]]
  >>> y_pred = [[3., 1., 2.]]
  >>> mrr = tfr.keras.metrics.MRRMetric()
  >>> mrr(y_true, y_pred).numpy()
  0.5
  
  >>> # Using ragged tensors
  >>> y_true = tf.ragged.constant([[0., 1.], [1., 2., 0.]])
  >>> y_pred = tf.ragged.constant([[2., 1.], [2., 5., 4.]])
  >>> mrr = tfr.keras.metrics.MRRMetric(ragged=True)
  >>> mrr(y_true, y_pred).numpy()
  0.75
  
  Usage with the `compile()` API:
  
  ```python
  model.compile(optimizer='sgd', metrics=[tfr.keras.metrics.MRRMetric()])
  ```
  
  Definition:
  
  $$
  \text{MRR}(\{y\}, \{s\}) = \max_i \frac{\bar{y}_i}{\text{rank}(s_i)}
  $$
  
  where $\text{rank}(s_i)$ is the rank of item $i$ after sorting by scores
  $s$ with ties broken randomly and $\bar{y_i}$ are truncated labels:
  
  $$
  \bar{y}_i = \begin{cases}
  1 & \text{if }y_i \geq 1 \\
  0 & \text{else}
  \end{cases}
  $$
class_docstr_tok: ["Mean","reciprocal","rank","(","MRR",")",".","For","each","list","of","scores","`","s","`","in","`","y_pred","`","and","list","of","labels","`","y","`","in","`","y_true","`",":","``","`","MRR","(","y",",","s",")","=","max_i","y_i","\/","rank","(","s_i",")","``","`","NOTE",":","This","metric","converts","graded","relevance","to","binary","relevance","by","setting","`","y_i","=","1","`","if","`","y_i",">","=","1","`",".","Standalone","usage",":",">",">",">","y_true","=","[","[","0.",",","1.",",","1",".","]","]",">",">",">","y_pred","=","[","[","3.",",","1.",",","2",".","]","]",">",">",">","mrr","=","tfr.keras.metrics.MRRMetric","(",")",">",">",">","mrr","(","y_true",",","y_pred",")",".numpy","(",")","0.5",">",">",">","#","Using","ragged","tensors",">",">",">","y_true","=","tf.ragged.constant","(","[","[","0.",",","1",".","]",",","[","1.",",","2.",",","0",".","]","]",")",">",">",">","y_pred","=","tf.ragged.constant","(","[","[","2.",",","1",".","]",",","[","2.",",","5.",",","4",".","]","]",")",">",">",">","mrr","=","tfr.keras.metrics.MRRMetric","(","ragged=True",")",">",">",">","mrr","(","y_true",",","y_pred",")",".numpy","(",")","0.75","Usage","with","the","`","compile","(",")","`","API",":","``","`","python","model.compile","(","optimizer='sgd","'",",","metrics=","[","tfr.keras.metrics.MRRMetric","(",")","]",")","``","`","Definition",":","$","$","\\text","{","MRR","}","(","\\","{","y\\","}",",","\\","{","s\\","}",")","=","\\max_i","\\frac","{","\\bar","{","y","}","_i","}","{","\\text","{","rank","}","(","s_i",")","}","$","$","where","$","\\text","{","rank","}","(","s_i",")","$","is","the","rank","of","item","$","i","$","after","sorting","by","scores","$","s","$","with","ties","broken","randomly","and","$","\\bar","{","y_i","}","$","are","truncated","labels",":","$","$","\\bar","{","y","}","_i","=","\\begin","{","cases","}","1","&","\\text","{","if","}","y_i","\\geq","1","\\\\","0","&","\\text","{","else","}","\\end","{","cases","}","$","$"]
code: def get_config(self):
      config = super(MRRMetric, self).get_config()
      config.update(
          {
              "topn": self._topn,
          }
      )
      return config
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from typing import Any, Dict, List, Optional
  import tensorflow.compat.v2
  from tensorflow_ranking.python import metrics_impl
  from tensorflow_ranking.python.keras import utils
label_desc: Use image node_id 2 for calling the MRRMetric obj's underlying member method code with example usage: obj.get_config() and returns: config