class_docstr: The Boltzmann exploration policy is intended for discrete action spaces. It assumes that each of the possible
  actions has some value assigned to it (such as the Q value), and uses a softmax function to convert these values
  into a distribution over the actions. It then samples the action for playing out of the calculated distribution.
  An additional temperature schedule can be given by the user, and will control the steepness of the softmax function.
class_docstr_tok: ["The","Boltzmann","exploration","policy","is","intended","for","discrete","action","spaces",".","It","assumes","that","each","of","the","possible","actions","has","some","value","assigned","to","it","(","such","as","the","Q","value",")",",","and","uses","a","softmax","function","to","convert","these","values","into","a","distribution","over","the","actions",".","It","then","samples","the","action","for","playing","out","of","the","calculated","distribution",".","An","additional","temperature","schedule","can","be","given","by","the","user",",","and","will","control","the","steepness","of","the","softmax","function","."]
code: def get_action(
      self, action_values: List[ActionType]
  ) -> (ActionType, List[float]):
      if self.phase == RunPhase.TRAIN:
          self.temperature_schedule.step()
      # softmax calculation
      exp_probabilities = np.exp(
          action_values / self.temperature_schedule.current_value
      )
      probabilities = exp_probabilities / np.sum(exp_probabilities)
      # make sure probs sum to 1
      probabilities[-1] = 1 - np.sum(probabilities[:-1])
      # choose actions according to the probabilities
      action = np.random.choice(
          range(self.action_space.shape), p=probabilities
      )
      return action, probabilities
  
file_path: coach/rl_coach/exploration_policies/boltzmann.py
imports: from typing import List
  import numpy
  from rl_coach.core_types import RunPhase, ActionType
  from rl_coach.exploration_policies.exploration_policy import DiscreteActionExplorationPolicy, ExplorationParameters
  from rl_coach.schedules import Schedule
  from rl_coach.spaces import ActionSpace
label_desc: Use image node_id 2 for calling the Boltzmann obj's underlying member method code with example usage: obj.get_action(action_values) and returns: action,  probabilities