releso.observation.ObservationDefinition

class releso.observation.ObservationDefinition(*, save_location: Path, logger_name: str | None = None, name: str, value_min: float, value_max: float)

Bases: BaseModel

Definition of an Observation.

Definition of a single Observations by providing the name of the value and the range in which the value is limited to.

The range is necessary due to normalization of the input of the agent networks.

__init__(**data: Any) None

Constructor for the ReLeSO basemodel object.

Methods

convert_to_pathlib_add_datetime(v)

Add timestamp to save_location, of applicable.

get_default_observation()

Provide default observations.

get_logger()

Gets the currently defined environment logger.

get_observation_definition()

Provide definition of the defined observations space.

set_logger_name_recursively(logger_name)

Set the logger_name variable for all child elements.

Attributes

name

Name of the observation

value_min

minimum of the range in which the observation is bound

value_max

maximum of the range in which the observation is bound

save_location

Definition of the save location of the logs and validation results.

logger_name

name of the logger.

get_default_observation() ndarray

Provide default observations.

Gives a default observations of the correct shape, purpose is when the observation fails that the observation can still be generated so that the training does not error out.

Returns:

An array filled with ones in the correct shape and size of the observation.

Return type:

np.ndarray

get_observation_definition() Tuple[str, gymnasium.spaces.Space]

Provide definition of the defined observations space.

Returns a tuple of name and observation definition defined via the gymnasium.observation interface

Returns:

Tuple of the name of the observation and a gymnasium.Box definition

Return type:

Tuple[str, Space]

name: str

Name of the observation

value_max: float

maximum of the range in which the observation is bound

value_min: float

minimum of the range in which the observation is bound