Obsprocessors

Processors for observations can be used to process the input for an agent before it is being passed to the agent.

source

BaseProcessor

 BaseProcessor ()

Initialize self. See help(type(self)) for accurate signature.


source

FlattenTimeDimNumpy

 FlattenTimeDimNumpy (allow_2d:Optional[bool]=False,
                      batch_dim_included:Optional[bool]=True)

Preprocessor to flatten the time and feature dimension of the input. Used, e.g., to convert time-series data for models that cannot process a time dimension such as MLPs or Regression models.

Type Default Details
allow_2d Optional False
batch_dim_included Optional True

source

FlattenTimeDimNumpy.check_input

 FlattenTimeDimNumpy.check_input (input:numpy.ndarray)

Check that the input is a Numpy array with the correct shape.

Type Details
input ndarray

source

FlattenTimeDimNumpy.__call__

 FlattenTimeDimNumpy.__call__ (input:numpy.ndarray)

Process the input array by keeping the batch dimension and flattening the time and feature dimensions.


source

ConvertDictSpace

 ConvertDictSpace (keep_time_dim:Optional[bool]=False,
                   hybrid_space_params:Optional[Dict]=None)

*A utility class to process a dictionary of numpy arrays, with options to preserve or flatten the time dimension.

Note, this class is only used to preprocess output from the environment without batch dimension.*

Type Default Details
keep_time_dim Optional False If time timension should be flattened as well.
hybrid_space_params Optional None dict with keys “time” that is a list of observation keys that should keep the time dimension.

source

AddParamsToFeaturesLEGACY

 AddParamsToFeaturesLEGACY (environment:object,
                            keep_time_dim:Optional[bool]=False,
                            hybrid:Optional[bool]=False,
                            receive_batch_dim:Optional[bool]=False)

A utility class to process a dictionary of numpy arrays, with options to preserve or flatten the time dimension. # TODO: Currently is mixes too many cases like batched input, hybrid input etc. Seperate into more specific obsprocessors.

Type Default Details
environment object The environment object, needed to check if val or train mode,
keep_time_dim Optional False If time timension should be flattened as well.
hybrid Optional False If the param dim should be added as separate vector or concatenated to the features.
receive_batch_dim Optional False If the input contains a batch dimension.

source

AddParamsToFeatures

 AddParamsToFeatures (environment:object,
                      keep_time_dim:Optional[bool]=False,
                      receive_batch_dim:Optional[bool]=False)

A utility class to process a dictionary of numpy arrays (from dict space), with options to preserve or flatten the time dimension. It always adds the parameters to the appropriate dimension. For composite spaces (partially time-series, partially not), use the separate AddParamsToFeaturesComposite class.

Type Default Details
environment object The environment object, needed to check if val or train mode,
keep_time_dim Optional False If time timension should be flattened as well.
receive_batch_dim Optional False If the input contains a batch dimension.