araffin / rl-tutorial-jnrr19

Stable-Baselines tutorial for Journées Nationales de la Recherche en Robotique 2019
MIT License
591 stars 113 forks source link

3_multiprocessing.ipynb: unused param in docstring and plot space #6

Closed rbahumi closed 4 years ago

rbahumi commented 4 years ago

First, I just want to say thank you very much for these notebooks they are very helpful!

Second, I have two small comments regarding the 3rd notebook, sorry if they are annoying...

  1. In the make_env() function there is unused param 'num_env' in the docstring
  2. The plots are overlapping, and the last line output is printed to the screen:

Screen Shot 2019-12-24 at 13 45 51

Adding the following matplotlib configs and capturing the last output with an underscore fixes the issue:

plt.figure(figsize=(9, 4))
plt.subplots_adjust(wspace=0.5)
.....
_ = plt.ylabel('Training steps per second')

Screen Shot 2019-12-24 at 13 58 37

Full code example:

training_steps_per_second = [s / t for s,t in zip(steps_per_experiment, training_times)]

plt.figure(figsize=(9, 4))
plt.subplots_adjust(wspace=0.5)
plt.subplot(1,2,1)
plt.errorbar(PROCESSES_TO_TEST, reward_averages, yerr=reward_std, capsize=2, c='k', marker='o')
plt.xlabel('Processes')
plt.ylabel('Average return')
plt.subplot(1,2,2)
plt.bar(range(len(PROCESSES_TO_TEST)), training_steps_per_second)
plt.xticks(range(len(PROCESSES_TO_TEST)),PROCESSES_TO_TEST)
plt.xlabel('Processes')
_ = plt.ylabel('Training steps per second')
araffin commented 4 years ago

Hello,

Thanks again for the remarks, I will fix that soon ;)

In the make_env() function there is unused param 'num_env' in the docstring

Oops... I think I wanted to write something like the make_vec_env that is now available in the v2.9.0 version. I should also update the evaluate_policy and the check_env.

The plots are overlapping, and the last line output is printed to the screen:

Thanks for the fixes. You will be credited in the README ;)