update
This commit is contained in:
@@ -5,15 +5,15 @@ Author: John
|
||||
Email: johnjim0816@gmail.com
|
||||
Date: 2020-10-07 20:57:11
|
||||
LastEditor: John
|
||||
LastEditTime: 2021-03-31 18:47:28
|
||||
LastEditTime: 2021-04-08 21:45:09
|
||||
Discription:
|
||||
Environment:
|
||||
'''
|
||||
import matplotlib.pyplot as plt
|
||||
import seaborn as sns
|
||||
def plot_rewards(rewards,ma_rewards,tag="train",algo = "DQN",save=True,path='./'):
|
||||
def plot_rewards(rewards,ma_rewards,tag="train",env='CartPole-v0',algo = "DQN",save=True,path='./'):
|
||||
sns.set()
|
||||
plt.title("average learning curve of {}".format(algo))
|
||||
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')
|
||||
|
||||
@@ -5,12 +5,14 @@ Author: John
|
||||
Email: johnjim0816@gmail.com
|
||||
Date: 2021-03-12 16:02:24
|
||||
LastEditor: John
|
||||
LastEditTime: 2021-04-03 21:42:13
|
||||
LastEditTime: 2021-04-13 18:34:20
|
||||
Discription:
|
||||
Environment:
|
||||
'''
|
||||
import os
|
||||
import numpy as np
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
|
||||
def save_results(rewards,ma_rewards,tag='train',path='./results'):
|
||||
@@ -22,8 +24,7 @@ def save_results(rewards,ma_rewards,tag='train',path='./results'):
|
||||
|
||||
def make_dir(*paths):
|
||||
for path in paths:
|
||||
if not os.path.exists(path): # check if exists
|
||||
os.mkdir(path)
|
||||
Path(path).mkdir(parents=True, exist_ok=True)
|
||||
def del_empty_dir(*paths):
|
||||
'''del_empty_dir delete empty folders unders "paths"
|
||||
'''
|
||||
|
||||
Reference in New Issue
Block a user