stable_learning_control.utils.plot
Module used for plotting the training results.
Note
This module was based on Spinning Up repository.
Attributes
Functions
|
Function used to plot data. |
|
Recursively look through logdir for output files produced by |
|
For every entry in all_logdirs, |
|
Function used for generating the plots. |
|
Run the plot utility. |
Module Contents
- stable_learning_control.utils.plot.plot_data(data, xaxis='Epoch', value='AverageEpRet', condition='Condition1', errorbar='sd', smooth=1, font_scale=1.5, style='darkgrid', **kwargs)[source]
Function used to plot data.
- Parameters:
data (obj) – The data you want to plot.
xaxis (str) – Pick what column from data is used for the x-axis. Defaults to
TotalEnvInteracts
.value (str) – Pick what columns from data to graph on the y-axis. Submitting multiple values will produce multiple graphs. Defaults to
Performance
, which is not an actual output of any algorithm. Instead,Performance
refers to eitherAverageEpRet
, the correct performance measure for the on-policy algorithms, orAverageTestEpRet
, the correct performance measure for the off-policy algorithms. The plotter will automatically figure out which ofAverageEpRet
orAverageTestEpRet
to report for each separate logdir.condition (str, optional) – The condition to search for. By default
Condition1
.errorbar (str) – The error bar you want to use for the plot. Defaults to
sd
.smooth (int) – Smooth data by averaging it over a fixed window. This parameter says how wide the averaging window will be.
font_scale (int) – The font scale you want to use for the plot text.
style (str) – The style you want to use for the plot.
- stable_learning_control.utils.plot.get_datasets(logdir, condition=None)[source]
Recursively look through logdir for output files produced by
EpochLogger
.Assumes that any file
progress.(csv|txt)
is a valid hit.
- stable_learning_control.utils.plot.get_all_datasets(all_logdirs, legend=None, select=None, exclude=None)[source]
- For every entry in all_logdirs,
check if the entry is a real directory and if it is, pull data from it;
if not, check to see if the entry is a prefix for a real directory, and pull data from that.
- Parameters:
all_logdirs (list) – A list of lig directories you want to use.
legend (list[str]) – Optional way to specify legend for the plot. The plotter legend will automatically use the
exp_name
from the config.json file, unless you tell it otherwise through this flag. This only works if you provide a name for each directory that will get plotted. (Note: this may not be the same as the number of logdir args you provide! Recall that the plotter looks for autocompletes of the logdir args: there may be more than one match for a given logdir prefix, and you will need to provide a legend string for each one of those matches—unless you have removed some of them as candidates via selection or exclusion rules (below).)select (list[str]) – Optional selection rule: the plotter will only show curves from logdirs that contain all of these substrings.
exclude (list[str]) – Optional exclusion rule: plotter will only show curves from logdirs that do not contain these substrings.
- stable_learning_control.utils.plot.make_plots(all_logdirs, legend=None, xaxis=None, values=None, count=False, font_scale=1.5, style='darkgrid', smooth=1, select=None, exclude=None, estimator='mean')[source]
Function used for generating the plots.
- Parameters:
logdir (str) – As many log directories (or prefixes to log directories, which the plotter will autocomplete internally) as you’d like to plot from.
legend (list[str]) – Optional way to specify legend for the plot. The plotter legend will automatically use the
exp_name
from the config.json file, unless you tell it otherwise through this flag. This only works if you provide a name for each directory that will get plotted. (Note: this may not be the same as the number of logdir args you provide! Recall that the plotter looks for autocompletes of the logdir args: there may be more than one match for a given logdir prefix, and you will need to provide a legend string for each one of those matches—unless you have removed some of them as candidates via selection or exclusion rules (below).)xaxis (str) – Pick what column from data is used for the x-axis. Defaults to
TotalEnvInteracts
.values (list) – Pick what columns from data to graph on the y-axis. Submitting multiple values will produce multiple graphs. Defaults to
Performance
, which is not an actual output of any algorithm. Instead,Performance
refers to eitherAverageEpRet
, the correct performance measure for the on-policy algorithms, orAverageTestEpRet
, the correct performance measure for the off-policy algorithms. The plotter will automatically figure out which ofAverageEpRet
orAverageTestEpRet
to report for each separate logdir.count – Optional flag. By default, the plotter shows y-values which are averaged across all results that share an
exp_name
, which is typically a set of identical experiments that only vary in random seed. But if you’d like to see all of those curves separately, use the--count
flag.font_scale (int) – The font scale you want to use for the plot text.
style (str) – The style you want to use for the plot.
smooth (int) – Smooth data by averaging it over a fixed window. This parameter says how wide the averaging window will be.
select (list[str]) – Optional selection rule: the plotter will only show curves from logdirs that contain all of these substrings.
exclude (list[str]) – Optional exclusion rule: plotter will only show curves from logdirs that do not contain these substrings.
estimator (str) – The estimator you want to use in your plot (ie. mean, min max).
- stable_learning_control.utils.plot.plot()[source]
Run the plot utility.
- Parameters:
logdir (list[str]) – As many log directories (or prefixes to log directories, which the plotter will autocomplete internally) as you’d like to plot from.
legend (list[str]) – Optional way to specify legend for the plot. The plotter legend will automatically use the
exp_name
from the config.json file, unless you tell it otherwise through this flag. This only works if you provide a name for each directory that will get plotted. (Note: this may not be the same as the number of logdir args you provide! Recall that the plotter looks for autocompletes of the logdir args: there may be more than one match for a given logdir prefix, and you will need to provide a legend string for each one of those matches—unless you have removed some of them as candidates via selection or exclusion rules (below).)xaxis (str) – Pick what column from data is used for the x-axis. Defaults to
TotalEnvInteracts
.value (str) – Pick what columns from data to graph on the y-axis. Submitting multiple values will produce multiple graphs. Defaults to
Performance
, which is not an actual output of any algorithm. Instead,Performance
refers to eitherAverageEpRet
, the correct performance measure for the on-policy algorithms, orAverageTestEpRet
, the correct performance measure for the off-policy algorithms. The plotter will automatically figure out which ofAverageEpRet
orAverageTestEpRet
to report for each separate logdir.count – Optional flag. By default, the plotter shows y-values which are averaged across all results that share an
exp_name
, which is typically a set of identical experiments that only vary in random seed. But if you’d like to see all of those curves separately, use the--count
flag.smooth (int) – Smooth data by averaging it over a fixed window. This parameter says how wide the averaging window will be.
select (list[str]) – Optional selection rule: the plotter will only show curves from logdirs that contain all of these substrings.
exclude (list[str]) – Optional exclusion rule: plotter will only show curves from logdirs that do not contain these substrings.