class_docstr: Computes the regret with respect to a baseline.
class_docstr_tok: ["Computes","the","regret","with","respect","to","a","baseline","."]
docstr: Computes the regret with respect to a baseline.
  
  The regret is computed by computing the difference of the current reward
  from the baseline action reward. The latter is computed by calling the input
  `baseline_reward_fn` function that given a (batched) observation computes
  the baseline action reward.
  
  Args:
    baseline_reward_fn: function that computes the reward used as a baseline
      for computing the regret.
    name: (str) name of the metric
    dtype: dtype of the metric value.
docstr_tok: ["Computes","the","regret","with","respect","to","a","baseline",".","The","regret","is","computed","by","computing","the","difference","of","the","current","reward","from","the","baseline","action","reward",".","The","latter","is","computed","by","calling","the","input","`","baseline_reward_fn","`","function","that","given","a","(","batched",")","observation","computes","the","baseline","action","reward",".","Args",":","baseline_reward_fn",":","function","that","computes","the","reward","used","as","a","baseline","for","computing","the","regret",".","name",":","(","str",")","name","of","the","metric","dtype",":","dtype","of","the","metric","value","."]
code: def __init__(
      self,
      baseline_reward_fn: Callable[[types.Tensor], types.Tensor],
      name: Optional[Text] = "RegretMetric",
      dtype: float = tf.float32,
  ):
      """Computes the regret with respect to a baseline.
  
      The regret is computed by computing the difference of the current reward
      from the baseline action reward. The latter is computed by calling the input
      `baseline_reward_fn` function that given a (batched) observation computes
      the baseline action reward.
  
      Args:
        baseline_reward_fn: function that computes the reward used as a baseline
          for computing the regret.
        name: (str) name of the metric
        dtype: dtype of the metric value.
      """
      self._baseline_reward_fn = baseline_reward_fn
      self.dtype = dtype
      self.regret = common.create_variable(
          initial_value=0, dtype=self.dtype, shape=(), name="regret"
      )
      super(RegretMetric, self).__init__(name=name)
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from typing import Callable, Optional, Text
  import gin
  import tensorflow
  from tf_agents.bandits.policies import constraints
  from tf_agents.bandits.specs import utils
  from tf_agents.metrics import tf_metric
  from tf_agents.typing import types
  from tf_agents.utils import common
label_desc: Use image node_id 1 to create a new RegretMetric object from inherited base classes: tf_metric with example: obj = RegretMetric(baseline_reward_fn, name, dtype)