Created
September 26, 2018 20:31
-
-
Save rizar/bba7574e53557ef4265f5b39cad807e1 to your computer and use it in GitHub Desktop.
Beautifult plots
This file contains 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
def compare_rl_and_gail(metric, window, ylabel=None, xlim=None, fs=15, ncol=2): | |
df1 = df_rl[df_rl['config.rp_weight'] == 1.0] | |
df2 = df_rl[df_rl['config.rp_weight'] == 0.0] | |
df3 = df_gail[df_gail['config.rmt.top_k_percent'] == 0.] | |
df4 = df_gail[df_gail['config.rmt.top_k_percent'] == 0.25] | |
df5 = df_gail[df_gail['config.rmt.top_k_percent'] == 0.5] | |
df6 = df_gail[df_gail['config.rmt.top_k_percent'] == 0.75] | |
for i, df in enumerate([df1, df2, df3, df4, df5, df6]): | |
value = 100 * pandas.rolling_mean(average_value(df, metric), window) | |
print(value.iloc[-1]) | |
pyplot.plot(value, color=COLORS[i], linewidth=0.5) | |
pyplot.legend(['A3C-RP', 'A3C', | |
'AGILE-A3C ρ=100', 'AGILE-A3C ρ=75', 'AGILE-A3C ρ=50', 'AGILE-A3C ρ=25'], | |
ncol=ncol, | |
prop={'size': fs}) | |
if xlim: | |
pyplot.xlim((0, xlim)) | |
pyplot.xlabel('environment steps', fontsize=fs) | |
pyplot.ylabel(metric if not ylabel else ylabel, fontsize=fs) | |
ax = pyplot.gca() | |
ax.xaxis.get_offset_text().set_size(fs) | |
for item in (ax.get_xticklabels() + ax.get_yticklabels()): | |
item.set_fontsize(fs) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment