本文整理汇总了Python中history.History方法的典型用法代码示例。如果您正苦于以下问题:Python history.History方法的具体用法?Python history.History怎么用?Python history.History使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类history
的用法示例。
在下文中一共展示了history.History方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: history
# 需要导入模块: import history [as 别名]
# 或者: from history import History [as 别名]
def history(self, interval=None, start=None, end=None):
return History(self._symbol, interval, start, end)
示例2: history
# 需要导入模块: import history [as 别名]
# 或者: from history import History [as 别名]
def history(self):
return History()
示例3: __init__
# 需要导入模块: import history [as 别名]
# 或者: from history import History [as 别名]
def __init__(self):
smoothing = config.get_entry('smoothing', default_value=True)
self.history = History(log.get_battery(), smoothing=smoothing)
self.future = Future(self.history)
示例4: main
# 需要导入模块: import history [as 别名]
# 或者: from history import History [as 别名]
def main():
env = RunEnv(visualize=False)
env.reset(difficulty = 0)
agent = RDPG(env)
returns = []
rewards = []
for episode in xrange(EPISODES):
state = env.reset(difficulty = 0)
reward_episode = []
print "episode:",episode
#Initializing empty history
history = History(state)
# Train
for step in xrange(env.spec.timestep_limit):
action = agent.noise_action(history)
next_state,reward,done,_ = env.step(action)
# appending to history
history.append(next_state,action,reward)
reward_episode.append(reward)
if done:
break
# storing the history into replay buffer and if the number of histories sequence is above the threshod, start training
agent.perceive(history)
# Testing:
#if episode % 1 == 0:
# if episode % 1000 == 0 and episode > 50:
# agent.save_model(PATH, episode)
# total_return = 0
# ave_reward = 0
# for i in xrange(TEST):
# state = env.reset()
# reward_per_step = 0
# for j in xrange(env.spec.timestep_limit):
# action = agent.action(state) # direct action for test
# state,reward,done,_ = env.step(action)
# total_return += reward
# if done:
# break
# reward_per_step += (reward - reward_per_step)/(j+1)
# ave_reward += reward_per_step
# ave_return = total_return/TEST
# ave_reward = ave_reward/TEST
# returns.append(ave_return)
# rewards.append(ave_reward)
# print 'episode: ',episode,'Evaluation Average Return:',ave_return, ' Evaluation Average Reward: ', ave_reward