Logger

class stable_baselines3.common.logger.CSVOutputFormat(filename: str)[source]
close() → None[source]

closes the file

write(key_values: Dict[str, Any], key_excluded: Dict[str, Union[str, Tuple[str, …]]], step: int = 0) → None[source]

Write a dictionary to file

Parameters
  • key_values – (dict)

  • key_excluded – (dict)

  • step – (int)

class stable_baselines3.common.logger.HumanOutputFormat(filename_or_file: Union[str, TextIO])[source]
close() → None[source]

closes the file

write(key_values: Dict, key_excluded: Dict, step: int = 0) → None[source]

Write a dictionary to file

Parameters
  • key_values – (dict)

  • key_excluded – (dict)

  • step – (int)

write_sequence(sequence: List) → None[source]

write_sequence an array to file

Parameters

sequence – (list)

class stable_baselines3.common.logger.JSONOutputFormat(filename: str)[source]
close() → None[source]

closes the file

write(key_values: Dict[str, Any], key_excluded: Dict[str, Union[str, Tuple[str, …]]], step: int = 0) → None[source]

Write a dictionary to file

Parameters
  • key_values – (dict)

  • key_excluded – (dict)

  • step – (int)

class stable_baselines3.common.logger.KVWriter[source]

Key Value writer

close() → None[source]

Close owned resources

write(key_values: Dict[str, Any], key_excluded: Dict[str, Union[str, Tuple[str, …]]], step: int = 0) → None[source]

Write a dictionary to file

Parameters
  • key_values – (dict)

  • key_excluded – (dict)

  • step – (int)

class stable_baselines3.common.logger.SeqWriter[source]

sequence writer

write_sequence(sequence: List)[source]

write_sequence an array to file

Parameters

sequence – (list)

class stable_baselines3.common.logger.TensorBoardOutputFormat(folder: str)[source]
close() → None[source]

closes the file

write(key_values: Dict[str, Any], key_excluded: Dict[str, Union[str, Tuple[str, …]]], step: int = 0) → None[source]

Write a dictionary to file

Parameters
  • key_values – (dict)

  • key_excluded – (dict)

  • step – (int)

stable_baselines3.common.logger.configure(folder: Optional[str] = None, format_strings: Optional[List[str]] = None) → None[source]

configure the current logger

Parameters
  • folder – (Optional[str]) the save location (if None, $SB3_LOGDIR, if still None, tempdir/baselines-[date & time])

  • format_strings – (Optional[List[str]]) the output logging format (if None, $SB3_LOG_FORMAT, if still None, [‘stdout’, ‘log’, ‘csv’])

stable_baselines3.common.logger.debug(*args) → None[source]

Write the sequence of args, with no separators, to the console and output files (if you’ve configured an output file). Using the DEBUG level.

Parameters

args – (list) log the arguments

stable_baselines3.common.logger.dump(step: int = 0) → None[source]

Write all of the diagnostics from the current iteration

stable_baselines3.common.logger.dump_tabular(step: int = 0) → None

Write all of the diagnostics from the current iteration

stable_baselines3.common.logger.error(*args) → None[source]

Write the sequence of args, with no separators, to the console and output files (if you’ve configured an output file). Using the ERROR level.

Parameters

args – (list) log the arguments

stable_baselines3.common.logger.get_dir() → str[source]

Get directory that log files are being written to. will be None if there is no output directory (i.e., if you didn’t call start)

Returns

(str) the logging directory

stable_baselines3.common.logger.get_level() → int[source]

Get logging threshold on current logger. :return: (int) the logging level (can be DEBUG=10, INFO=20, WARN=30, ERROR=40, DISABLED=50)

stable_baselines3.common.logger.get_log_dict() → Dict[source]

get the key values logs

Returns

(dict) the logged values

stable_baselines3.common.logger.info(*args) → None[source]

Write the sequence of args, with no separators, to the console and output files (if you’ve configured an output file). Using the INFO level.

Parameters

args – (list) log the arguments

stable_baselines3.common.logger.log(*args, level: int = 20) → None[source]

Write the sequence of args, with no separators, to the console and output files (if you’ve configured an output file).

level: int. (see logger.py docs) If the global logger level is higher than

the level argument here, don’t print to stdout.

Parameters
  • args – (list) log the arguments

  • level – (int) the logging level (can be DEBUG=10, INFO=20, WARN=30, ERROR=40, DISABLED=50)

stable_baselines3.common.logger.make_output_format(_format: str, log_dir: str, log_suffix: str = '')stable_baselines3.common.logger.KVWriter[source]

return a logger for the requested format

Parameters
  • _format – (str) the requested format to log to (‘stdout’, ‘log’, ‘json’ or ‘csv’ or ‘tensorboard’)

  • log_dir – (str) the logging directory

  • log_suffix – (str) the suffix for the log file

Returns

(KVWriter) the logger

stable_baselines3.common.logger.read_csv(filename: str) → pandas.core.frame.DataFrame[source]

read a csv file using pandas

Parameters

filename – (str) the file path to read

Returns

(pandas.DataFrame) the data in the csv

stable_baselines3.common.logger.read_json(filename: str) → pandas.core.frame.DataFrame[source]

read a json file using pandas

Parameters

filename – (str) the file path to read

Returns

(pandas.DataFrame) the data in the json

stable_baselines3.common.logger.record(key: str, value: Any, exclude: Optional[Union[str, Tuple[str, …]]] = None) → None[source]

Log a value of some diagnostic Call this once for each diagnostic quantity, each iteration If called many times, last value will be used.

Parameters
  • key – (Any) save to log this key

  • value – (Any) save to log this value

  • exclude – (str or tuple) outputs to be excluded

stable_baselines3.common.logger.record_dict(key_values: Dict[str, Any]) → None[source]

Log a dictionary of key-value pairs.

Parameters

key_values – (dict) the list of keys and values to save to log

stable_baselines3.common.logger.record_mean(key: str, value: Union[int, float], exclude: Optional[Union[str, Tuple[str, …]]] = None) → None[source]

The same as record(), but if called many times, values averaged.

Parameters
  • key – (Any) save to log this key

  • value – (Number) save to log this value

  • exclude – (str or tuple) outputs to be excluded

stable_baselines3.common.logger.record_tabular(key: str, value: Any, exclude: Optional[Union[str, Tuple[str, …]]] = None) → None

Log a value of some diagnostic Call this once for each diagnostic quantity, each iteration If called many times, last value will be used.

Parameters
  • key – (Any) save to log this key

  • value – (Any) save to log this value

  • exclude – (str or tuple) outputs to be excluded

stable_baselines3.common.logger.reset() → None[source]

reset the current logger

stable_baselines3.common.logger.set_level(level: int) → None[source]

Set logging threshold on current logger.

Parameters

level – (int) the logging level (can be DEBUG=10, INFO=20, WARN=30, ERROR=40, DISABLED=50)

stable_baselines3.common.logger.warn(*args) → None[source]

Write the sequence of args, with no separators, to the console and output files (if you’ve configured an output file). Using the WARN level.

Parameters

args – (list) log the arguments