evorl.recorders

Package Contents

Classes

ChainRecorder

Container for multiple recorders.

LogRecorder

Log file recorder.

Recorder

A Recorder Interface.

WandbRecorder

Recorder for Weights & Biases.

Functions

add_prefix

Add prefix to the keys of a dictionary.

get_1d_array

Get statistics of a 1D array.

get_1d_array_statistics

Get raw value and statistics of a 1D array.

API

class evorl.recorders.ChainRecorder(recorders: collections.abc.Sequence[evorl.recorders.recorder.Recorder])[source]

Bases: evorl.recorders.recorder.Recorder

Container for multiple recorders.

add_recorder(recorder: evorl.recorders.recorder.Recorder) None[source]
close() None[source]
init() None[source]
write(data: collections.abc.Mapping[str, Any], step: int | None = None) None[source]
class evorl.recorders.LogRecorder(log_path: str, console: bool = True)[source]

Bases: evorl.recorders.recorder.Recorder

Log file recorder.

close() None[source]
init() None[source]
write(data: collections.abc.Mapping[str, Any], step: int | None = None) None[source]
class evorl.recorders.Recorder[source]

Bases: abc.ABC

A Recorder Interface.

abstract close() None[source]

Finalize the recorder.

abstract init() None[source]

Initialize the recorder.

abstract write(data: collections.abc.Mapping[str, Any], step: int | None = None) None[source]

Write data to the recorder.

class evorl.recorders.WandbRecorder(*, project, name, config, tags, path, **wandb_kwargs)[source]

Bases: evorl.recorders.recorder.Recorder

Recorder for Weights & Biases.

close()[source]
init() None[source]
write(data: collections.abc.Mapping[str, Any], step: int | None = None) None[source]
evorl.recorders.add_prefix(data: dict, prefix: str)[source]

Add prefix to the keys of a dictionary.

evorl.recorders.get_1d_array(data)[source]

Get statistics of a 1D array.

Similar to get_1d_array_statistics, but instead of recording histogram, WandB will record the raw data.

evorl.recorders.get_1d_array_statistics(data, histogram=False)[source]

Get raw value and statistics of a 1D array.

Helper function for logging in WandB.

Parameters:
  • data – 1D numpy array. If data has multiple dimensions, it will be viewed as flattened.

  • histogram – If True, return raw data in pd.Series, which will be futher converted to histogram in WandBRecorder.

Returns:

A dictionary containing min, max, mean, and optional raw data.