[Docs] Custom environment tutorial refactoring (#709)

This commit is contained in:
Andrea PIERRÉ
2023-09-11 09:25:48 +00:00
committed by GitHub
parent d9a8d66123
commit baf78078c3
3 changed files with 133 additions and 72 deletions

View File

@@ -9,8 +9,8 @@ Frozenlake benchmark
# In this post we'll compare a bunch of different map sizes on the
# `FrozenLake <https://gymnasium.farama.org/environments/toy_text/frozen_lake/>`__
# environment from the reinforcement learning
# `Gymnasium <https://gymnasium.farama.org/>`__ using the Q-learning
# algorithm.
# `Gymnasium <https://gymnasium.farama.org/>`__ package using the
# Q-learning algorithm.
#
@@ -263,8 +263,8 @@ def postprocess(episodes, params, rewards, steps, map_size):
res = pd.DataFrame(
data={
"Episodes": np.tile(episodes, reps=params.n_runs),
"Rewards": rewards.flatten(),
"Steps": steps.flatten(),
"Rewards": rewards.flatten(order="F"),
"Steps": steps.flatten(order="F"),
}
)
res["cum_rewards"] = rewards.cumsum(axis=0).flatten(order="F")