docstr: 根据观测值 obs 采样（带探索）一个动作
          
code: def sample(self, obs):
      """根据观测值 obs 采样（带探索）一个动作"""
      sample = np.random.random()  # 产生0~1之间的小数
      if sample < self.e_greed:
          act = np.random.randint(self.act_dim)  # 探索：每个动作都有概率被选择
      else:
          act = self.predict(obs)  # 选择最优动作
      self.e_greed = max(
          0.01, self.e_greed - self.e_greed_decrement
      )  # 随着训练逐步收敛，探索的程度慢慢降低
      return act
  
file_path: PARL/examples/tutorials/parl2_dygraph/lesson3/homework/dqn_mountaincar/agent.py
imports: import parl
  import paddle
  import numpy
label_desc: Use image node_id 2 for calling the Agent obj's underlying member method code with example usage: obj.sample(obs) and returns: act