Example #1
0
}

set_figure_params(serif=True, fontsize=12)
fig, axes = plt.subplots(ncols=4, nrows=2, sharey=True)
fig.set_size_inches(6.75, 2)

for i, (environment, max_value) in enumerate(ENVIRONMENTS.items()):
    row, col = i // 4, i % 4

    df = pd.read_pickle(f"{environment}/{environment}_results.pkl")
    df = df[df.name != "DQN-delayed"]
    df = df[df.name != "REINFORCE"]
    plot_df_key(
        df=df,
        axes=axes[row, col],
        key="value_evaluation" if environment != "cart_pole" else "train_return",
        get_color=get_color,
        get_linestyle=get_linestyle,
        max_value=max_value,
    )
    if environment == "two_state_deterministic":
        title = "Two State D"
    elif environment == "two_state_stochastic":
        title = "Two State S"
    elif environment == "windy_grid_world":
        title = "Grid World"
    else:
        title = " ".join(environment.split("_")).title()

    axes[row, col].set_title(title, fontsize=11)

for col in range(4):
"""Python Script Template."""
import pandas as pd
import matplotlib.pyplot as plt
from exps.plotting import plot_df_key, set_figure_params
from exps.environments.utilities import get_color, get_linestyle

df = pd.read_pickle("two_state_deterministic_results.pkl")
set_figure_params(serif=True)
fig, axes = plt.subplots(ncols=1, nrows=1)
plot_df_key(
    df=df,
    axes=axes,
    key="value_evaluation",
    get_color=get_color,
    get_linestyle=get_linestyle,
)

plt.xlabel("Episode")
plt.ylabel("Reward")
plt.title(f"Two-State-Deterministic")
# plt.legend(loc="best", frameon=False)
plt.legend(bbox_to_anchor=(0.52, 0.3), loc="lower left", frameon=False, ncol=2)
plt.savefig("two_state_deterministic_results.pdf", bbox_inches="tight")
Example #3
0
"""Python Script Template."""
import pandas as pd
import matplotlib.pyplot as plt
from exps.plotting import plot_df_key, set_figure_params
from exps.environments.utilities import get_color, get_linestyle

df = pd.read_pickle("cart_pole_results.pkl")
df = df[df.time < 25]
# set_figure_params(serif=True)
fig, axes = plt.subplots(ncols=1, nrows=1)
plot_df_key(
    df=df,
    axes=axes,
    key="train_return",
    get_color=get_color,
    get_linestyle=get_linestyle,
)

plt.xlabel("Episode")
plt.ylabel("Reward")
plt.title(f"Cart-Pole")
plt.legend(loc="best", frameon=False)
# plt.legend(bbox_to_anchor=(0.7, 0.32), loc="lower left", frameon=False)
plt.savefig("cart_pole_results.pdf", bbox_inches="tight")