Created
January 14, 2020 12:40
-
-
Save pythonlessons/bd623a485b275c637c4c529db4379a09 to your computer and use it in GitHub Desktop.
02_CartPole-reinforcement-learning_DDQN
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pylab.figure(figsize=(18, 9)) | |
def PlotModel(self, score, episode): | |
self.scores.append(score) | |
self.episodes.append(episode) | |
self.average.append(sum(self.scores) / len(self.scores)) | |
pylab.plot(self.episodes, self.average, 'r') | |
pylab.plot(self.episodes, self.scores, 'b') | |
pylab.ylabel('Score', fontsize=18) | |
pylab.xlabel('Steps', fontsize=18) | |
dqn = 'DQN_' | |
softupdate = '' | |
if self.ddqn: | |
dqn = 'DDQN_' | |
if self.Soft_Update: | |
softupdate = '_soft' | |
try: | |
pylab.savefig(dqn+self.env_name+softupdate+".png") | |
except OSError: | |
pass | |
return str(self.average[-1])[:5] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment