Guest User

Untitled

a guest
Oct 19th, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. scores = []
  2. choices = []
  3. for each_game in range(100):
  4. score = 0
  5. prev_obs = []
  6. for step_index in range(goal_steps):
  7. env.render()
  8. if len(prev_obs)==0:
  9. action = random.randrange(0,2)
  10. else:
  11. action = np.argmax(trained_model.predict(prev_obs.reshape(-1, len(prev_obs)))[0])
  12.  
  13. choices.append(action)
  14. new_observation, reward, done, info = env.step(action)
  15. prev_obs = new_observation
  16. score+=reward
  17. if done:
  18. break
  19.  
  20. env.reset()
  21. scores.append(score)
  22.  
  23. print(scores)
  24. print('Average Score:', sum(scores)/len(scores))
  25. print('choice 1:{} choice 0:{}'.format(choices.count(1)/len(choices),choices.count(0)/len(choices)))
Add Comment
Please, Sign In to add comment