Python中类函数的动态修改
Python中类函数的动态修改(示例):
self = agent

# def egreedy_action(self,state):
def egreedy_action( state ):
    Q_value = self.Q_value.eval(feed_dict = {
      self.state_input:[state]
      })[0]
    if 0: #random.random() < 0.5:
        return random.randint(0,self.action_dim - 1)
    else:
        return np.argmax(Q_value)

agent.egreedy_action = egreedy_action


深度学习推荐
深度学习推荐

墨之科技,版权所有 © Copyright 2017-2027

湘ICP备14012786号     邮箱:ai@inksci.com