Plotting Results¶
-
stable_baselines.results_plotter.
main
()[source]¶ Example usage in jupyter-notebook
from stable_baselines import results_plotter %matplotlib inline results_plotter.plot_results(["./log"], 10e6, log_viewer.X_TIMESTEPS, "Breakout")
Here ./log is a directory containing the monitor.csv files
-
stable_baselines.results_plotter.
plot_curves
(xy_list, xaxis, title)[source]¶ plot the curves
Parameters: - xy_list – ([(np.ndarray, np.ndarray)]) the x and y coordinates to plot
- xaxis – (str) the axis for the x and y output (can be X_TIMESTEPS=’timesteps’, X_EPISODES=’episodes’ or X_WALLTIME=’walltime_hrs’)
- title – (str) the title of the plot
-
stable_baselines.results_plotter.
plot_results
(dirs, num_timesteps, xaxis, task_name)[source]¶ plot the results
Parameters: - dirs – ([str]) the save location of the results to plot
- num_timesteps – (int or None) only plot the points below this value
- xaxis – (str) the axis for the x and y output (can be X_TIMESTEPS=’timesteps’, X_EPISODES=’episodes’ or X_WALLTIME=’walltime_hrs’)
- task_name – (str) the title of the task to plot
-
stable_baselines.results_plotter.
rolling_window
(array, window)[source]¶ apply a rolling window to a np.ndarray
Parameters: - array – (np.ndarray) the input Array
- window – (int) length of the rolling window
Returns: (np.ndarray) rolling window on the input array
-
stable_baselines.results_plotter.
ts2xy
(timesteps, xaxis)[source]¶ Decompose a timesteps variable to x ans ys
Parameters: - timesteps – (Pandas DataFrame) the input data
- xaxis – (str) the axis for the x and y output (can be X_TIMESTEPS=’timesteps’, X_EPISODES=’episodes’ or X_WALLTIME=’walltime_hrs’)
Returns: (np.ndarray, np.ndarray) the x and y output
-
stable_baselines.results_plotter.
window_func
(var_1, var_2, window, func)[source]¶ apply a function to the rolling window of 2 arrays
Parameters: - var_1 – (np.ndarray) variable 1
- var_2 – (np.ndarray) variable 2
- window – (int) length of the rolling window
- func – (numpy function) function to apply on the rolling window on variable 2 (such as np.mean)
Returns: (np.ndarray, np.ndarray) the rolling output with applied function