本文整理汇总了Python中agent.Agent.test方法的典型用法代码示例。如果您正苦于以下问题:Python Agent.test方法的具体用法?Python Agent.test怎么用?Python Agent.test使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类agent.Agent
的用法示例。
在下文中一共展示了Agent.test方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: xrange
# 需要导入模块: from agent import Agent [as 别名]
# 或者: from agent.Agent import test [as 别名]
if args.random_steps:
# populate replay memory with random steps
logger.info("Populating replay memory with %d random moves" % args.random_steps)
stats.reset()
agent.play_random(args.random_steps)
stats.write(0, "random")
# loop over epochs
for epoch in xrange(args.epochs):
logger.info("Epoch #%d" % (epoch + 1))
if args.train_steps:
logger.info(" Training for %d steps" % args.train_steps)
stats.reset()
agent.train(args.train_steps, epoch)
stats.write(epoch + 1, "train")
if args.save_weights_prefix:
filename = args.save_weights_prefix + "_%d.prm" % (epoch + 1)
logger.info("Saving weights to %s" % filename)
net.save_weights(filename)
if args.test_steps:
logger.info(" Testing for %d steps" % args.test_steps)
stats.reset()
agent.test(args.test_steps, epoch)
stats.write(epoch + 1, "test")
stats.close()
logger.info("All done")
示例2: Agent
# 需要导入模块: from agent import Agent [as 别名]
# 或者: from agent.Agent import test [as 别名]
agent = Agent(env, mem, network)
if args.train_model:
#stats = Statistics(agent, network, mem, env)
agent.play_random(random_steps=default_random_steps)
print "Traning Started....."
for i in range(EPOCHS):
#stats.reset()
a = datetime.datetime.now().replace(microsecond=0)
agent.train(train_steps = STEPS_PER_EPOCH,epoch = 1)
agent.test(test_steps = STEPS_PER_TEST,epoch = 1)
save_path = args.save_model_dir
if args.save_models:
path_file = args.save_model_dir+'/dep-q-shooter-nipscuda-8movectrl-'+str(i)+'-epoch.pkl'
#print path_file
net_file = open(path_file, 'w')
cPickle.dump(network, net_file, -1)
net_file.close()
b = datetime.datetime.now().replace(microsecond=0)
#stats.write(i + 1, "train")
print "Completed "+str(i+1)+"/"+str(EPOCHS)+" epochs in ",(b-a)
print "Training Ended....."
if args.play_games > 0:
agent.play(args.play_games)