class_docstr: Q-learning agent with tabular representation.
class_docstr_tok: ["Q-learning","agent","with","tabular","representation","."]
docstr: Constructor for Q learning algorithm with tabular representation.
docstr_tok: ["Constructor","for","Q","learning","algorithm","with","tabular","representation","."]
code: def __init__(self, cfg_filename, o_space, a_space):
      """Constructor for Q learning algorithm with tabular representation."""
      super(TabularQLearning, self).__init__(o_space, a_space)
  
      self._parameters = QLearningParameters(cfg_filename)
      if self._parameters.q_representation != "tabular":
          raise ValueError(
              'Unexpected representation for tabular Q-learning: "{0}"'
              "\n".format(self._parameters.q_representation)
          )
  
      # Discretize the observation space if necessary
      if self._classname(o_space) != "gym.spaces.discrete.Discrete":
          self._discretize_observation_space(
              o_space, self._parameters.discretization_resolution
          )
  
      self._q = self._parameters.initial_q + np.zeros(
          (self._num_states, self._num_actions)
      )
      print(
          "Initialized discrete Q-learning agent with {0} states and "
          "{1} actions.".format(self._num_states, self._num_actions)
      )
  
      self.episode_count = 0
      # step_count is incremented each time after receiving reward.
      self.step_count = 0
  
file_path: CNTK/bindings/python/cntk/contrib/deeprl/agent/tabular_qlearning.py
imports: import copy
  import numpy
  from .agent import AgentBaseClass
  from .shared.qlearning_parameters import QLearningParameters
label_desc: Use image node_id 1 to create a new TabularQLearning object from inherited base classes: AgentBaseClass with example: obj = TabularQLearning(cfg_filename, o_space, a_space)