This commit is contained in:
johnjim0816
2021-04-28 22:11:22 +08:00
parent e4690ac89f
commit ed7b60fd5b
73 changed files with 502 additions and 187 deletions

View File

@@ -5,7 +5,7 @@ Author: John
Email: johnjim0816@gmail.com
Date: 2020-10-07 20:57:11
LastEditor: John
LastEditTime: 2021-04-08 21:45:09
LastEditTime: 2021-04-28 10:13:21
Discription:
Environment:
'''
@@ -16,12 +16,21 @@ def plot_rewards(rewards,ma_rewards,tag="train",env='CartPole-v0',algo = "DQN",s
plt.title("average learning curve of {} for {}".format(algo,env))
plt.xlabel('epsiodes')
plt.plot(rewards,label='rewards')
plt.plot(ma_rewards,label='moving average rewards')
plt.plot(ma_rewards,label='ma rewards')
plt.legend()
if save:
plt.savefig(path+"rewards_curve_{}".format(tag))
plt.show()
# def plot_rewards(dic,tag="train",env='CartPole-v0',algo = "DQN",save=True,path='./'):
# sns.set()
# plt.title("average learning curve of {} for {}".format(algo,env))
# plt.xlabel('epsiodes')
# for key, value in dic.items():
# plt.plot(value,label=key)
# plt.legend()
# if save:
# plt.savefig(path+algo+"_rewards_curve_{}".format(tag))
# plt.show()
def plot_losses(losses,algo = "DQN",save=True,path='./'):
sns.set()
plt.title("loss curve of {}".format(algo))