def graph_rewards_seq_len(filepaths): initrewards = [] min_len = 10000000 for f in filepaths: r = np.load(f)['values'] mr = logger.moving_average(r, 5) if len(mr) < min_len: min_len = len(mr) initrewards.append(mr) rewards = [] for r in initrewards: rewards.append(r[:min_len]) r2 = plt.plot(rewards[0], label='length 2 sequence', color='orange') r4 = plt.plot(rewards[1], label='length 4 sequence', color='crimson') r8 = plt.plot(rewards[2], label='length 8 sequence', color='cyan') r12 = plt.plot(rewards[3], label='length 12 sequence', color='brown') r16 = plt.plot(rewards[4], label='length 16 sequence', color='blue') r20 = plt.plot(rewards[5], label='length 20 sequence', color='black') r24 = plt.plot(rewards[6], label='length 24 sequence', color='pink') plt.legend(loc='lower right') plt.ylabel('Episode Rewards') plt.xlabel('Epochs') plt.savefig('/Users/wulfe/Dropbox/School/Stanford/winter_2016/cs239/project/hierarchical_rl/results/seqlen_rewards.png')
def graph_rewards_seq_len(filepaths): initrewards = [] min_len = 10000000 for f in filepaths: r = np.load(f)['values'] mr = logger.moving_average(r, 5) if len(mr) < min_len: min_len = len(mr) initrewards.append(mr) rewards = [] for r in initrewards: rewards.append(r[:min_len]) r2 = plt.plot(rewards[0], label='length 2 sequence', color='orange') r4 = plt.plot(rewards[1], label='length 4 sequence', color='crimson') r8 = plt.plot(rewards[2], label='length 8 sequence', color='cyan') r12 = plt.plot(rewards[3], label='length 12 sequence', color='brown') r16 = plt.plot(rewards[4], label='length 16 sequence', color='blue') r20 = plt.plot(rewards[5], label='length 20 sequence', color='black') r24 = plt.plot(rewards[6], label='length 24 sequence', color='pink') plt.legend(loc='lower right') plt.ylabel('Episode Rewards') plt.xlabel('Epochs') plt.savefig( '/Users/wulfe/Dropbox/School/Stanford/winter_2016/cs239/project/hierarchical_rl/results/seqlen_rewards.png' )
def graph_rewards(filepaths): rewards = [] for f in filepaths: r = np.load(f)['values'] mr = logger.moving_average(r, 10) rewards.append(mr) plt.plot(rewards[0], label='row/col + room', color='r') plt.plot(rewards[1], label='row/col only', color='g') plt.plot(rewards[2], label='tabular', color='b') plt.plot(rewards[3], label='coordinates', color='magenta') plt.legend(loc='upper left') plt.ylabel('Episode Rewards') plt.xlabel('Epochs') plt.savefig('/Users/wulfe/Dropbox/School/Stanford/winter_2016/cs239/project/hierarchical_rl/results/staterep_rewards.png')
def graph_rewards(filepaths): rewards = [] for f in filepaths: r = np.load(f)['values'] mr = logger.moving_average(r, 10) rewards.append(mr) plt.plot(rewards[0], label='row/col + room', color='r') plt.plot(rewards[1], label='row/col only', color='g') plt.plot(rewards[2], label='tabular', color='b') plt.plot(rewards[3], label='coordinates', color='magenta') plt.legend(loc='upper left') plt.ylabel('Episode Rewards') plt.xlabel('Epochs') plt.savefig( '/Users/wulfe/Dropbox/School/Stanford/winter_2016/cs239/project/hierarchical_rl/results/staterep_rewards.png' )