code: def testMaxExplorationProbabilityHintAmbiguousRewards(self):
      batch_size = 1000
      # Constructs a batch of observations such that action 1 is always the greedy
      # choice, action 0 is almost as good, and action 2 is much worse in
      # predicted rewards.
      observations = tf.stack(
          values=[
              tf.constant(1e-5, shape=[batch_size], dtype=tf.float32),
              tf.random.uniform(
                  shape=[batch_size], maxval=1e-5, dtype=tf.float32
              ),
          ],
          axis=1,
      )
      time_step = ts.restart(observations, batch_size=batch_size)
  
      # Creates a policy with `max_exploration_probability_hint`to 5%, which is
      # expected to apply only to action 2 because it has much worse predicted
      # rewards than actions 1 (greedy) and 0 (runner-up). Action 1 is expected to
      # be chosen the most often, while action 0 is expected to be chosen with
      # probability close to 1.0 / num_actions.
      limited_exploration_policy = self._create_policy(
          use_mask=False,
          exploitation_coefficient=10.0,
          max_exploration_probability_hint=0.05,
          num_samples_list=[
              tf.compat.v2.Variable(
                  int(500000), dtype=tf.int32, name="num_samples_0"
              ),
              tf.compat.v2.Variable(
                  int(500000), dtype=tf.int32, name="num_samples_1"
              ),
              tf.compat.v2.Variable(
                  int(500000), dtype=tf.int32, name="num_samples_2"
              ),
          ],
      )
      action_step = limited_exploration_policy.action(time_step, seed=1)
      self.evaluate(tf.compat.v1.global_variables_initializer())
      actions = self.evaluate(action_step.action)
      p_info = self.evaluate(action_step.info)
      print(p_info.predicted_rewards_mean)
      self.assertGreater(np.sum(actions == 0), 0.3 * batch_size)
      self.assertGreater(np.sum(actions == 1), np.sum(actions == 0))
      # Sets the upperbound to be a bit larger than expected for test robustness
      # against random sampling.
      self.assertLess(np.sum(actions == 2), 0.1 * batch_size)
  
imports: from typing import List, Optional, Set
  from absl.testing import parameterized
  import numpy
  import tensorflow
  from tf_agents.bandits.policies import falcon_reward_prediction_policy
  from tf_agents.networks import network
  from tf_agents.policies import utils
  from tf_agents.specs import tensor_spec
  from tf_agents.trajectories import time_step
  from tf_agents.utils import test_utils
  from tensorflow.python.framework import test_util
label_desc: Use image node_id 10 for calling the FalconRewardPredictionPolicyTest obj's underlying member method code with example usage: obj.testMaxExplorationProbabilityHintAmbiguousRewards() without return types