class_docstr: An agent implementing the EXP3 bandit algorithm.
  
  Implementation based on
  
  "Bandit Algorithms"
    Lattimore and Szepesvari, 2019
    https://tor-lattimore.com/downloads/book/book.pdf
class_docstr_tok: ["An","agent","implementing","the","EXP3","bandit","algorithm",".","Implementation","based","on","''","Bandit","Algorithms","''","Lattimore","and","Szepesvari",",","2019","https",":","\/\/tor-lattimore.com\/downloads\/book\/book.pdf"]
docstr: Initialize an instance of `Exp3Agent`.
  
  Args:
    time_step_spec: A `TimeStep` spec describing the expected `TimeStep`s.
    action_spec: A scalar `BoundedTensorSpec` with `int32` or `int64` dtype
      describing the number of actions for this agent.
    learning_rate: A float valued scalar. A higher value will force the agent
      to converge on a single action more quickly. A lower value will
      encourage more exploration. This value corresponds to the
      `inverse_temperature` argument passed to `CategoricalPolicy`.
    name: a name for this instance of `Exp3Agent`.
docstr_tok: ["Initialize","an","instance","of","`","Exp3Agent","`",".","Args",":","time_step_spec",":","A","`","TimeStep","`","spec","describing","the","expected","`","TimeStep","`","s",".","action_spec",":","A","scalar","`","BoundedTensorSpec","`","with","`","int32","`","or","`","int64","`","dtype","describing","the","number","of","actions","for","this","agent",".","learning_rate",":","A","float","valued","scalar",".","A","higher","value","will","force","the","agent","to","converge","on","a","single","action","more","quickly",".","A","lower","value","will","encourage","more","exploration",".","This","value","corresponds","to","the","`","inverse_temperature","`","argument","passed","to","`","CategoricalPolicy","`",".","name",":","a","name","for","this","instance","of","`","Exp3Agent","`","."]
code: def __init__(
      self,
      time_step_spec: types.TimeStep,
      action_spec: types.BoundedTensorSpec,
      learning_rate: float,
      name: Optional[Text] = None,
  ):
      """Initialize an instance of `Exp3Agent`.
  
      Args:
        time_step_spec: A `TimeStep` spec describing the expected `TimeStep`s.
        action_spec: A scalar `BoundedTensorSpec` with `int32` or `int64` dtype
          describing the number of actions for this agent.
        learning_rate: A float valued scalar. A higher value will force the agent
          to converge on a single action more quickly. A lower value will
          encourage more exploration. This value corresponds to the
          `inverse_temperature` argument passed to `CategoricalPolicy`.
        name: a name for this instance of `Exp3Agent`.
      """
      tf.Module.__init__(self, name=name)
      common.tf_agents_gauge.get_cell("TFABandit").set(True)
      self._num_actions = (
          policy_utilities.get_num_actions_from_tensor_spec(action_spec)
      )
      self._weights = tf.compat.v2.Variable(
          tf.zeros(self._num_actions), name="weights"
      )
      self._learning_rate = tf.compat.v2.Variable(
          learning_rate, name="learning_rate"
      )
      policy = categorical_policy.CategoricalPolicy(
          weights=self._weights,
          time_step_spec=time_step_spec,
          action_spec=action_spec,
          inverse_temperature=self._learning_rate,
      )
      # TODO(b/127462472): consider policy=GreedyPolicy(collect_policy).
      super(Exp3Agent, self).__init__(
          time_step_spec=time_step_spec,
          action_spec=policy.action_spec,
          policy=policy,
          collect_policy=policy,
          train_sequence_length=None,
      )
      self._as_trajectory = data_converter.AsTrajectory(
          self.data_context, sequence_length=None
      )
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from typing import Optional, Text
  import gin
  import tensorflow
  from tf_agents.agents import data_converter
  from tf_agents.agents import tf_agent
  from tf_agents.bandits.policies import categorical_policy
  from tf_agents.policies import utils
  from tf_agents.trajectories import policy_step
  from tf_agents.typing import types
  from tf_agents.utils import common
label_desc: Use image node_id 1 to create a new Exp3Agent object from inherited base classes: tf_agent with example: obj = Exp3Agent(time_step_spec, action_spec, learning_rate, name)