Advertisement
Guest User

Untitled

a guest
May 23rd, 2019
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. # use the test set to evaluate the policy
  2. states = Tt[:, :, 0].flatten().tolist()
  3.  
  4. values = []
  5. best_actions = []
  6. for s in states:
  7. a_best, v_best = best_action(Q, s, offers)
  8. values.append(v_best)
  9. best_actions.append(a_best)
  10.  
  11. s_tsne = TSNE().fit_transform(states)
  12.  
  13. # value function for each state
  14. plt.scatter(s_tsne[:, 0], s_tsne[:, 1], c = values)
  15. plt.colorbar()
  16. plt.show()
  17.  
  18. # recommended next best actions for each state
  19. plt.scatter(s_tsne[:, 0], s_tsne[:, 1], c = best_actions)
  20. plt.colorbar()
  21. plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement