TrajectoryProcessor¶
- class maze.core.trajectory_recording.datasets.trajectory_processor.TrajectoryProcessor¶
Base class for processing individual trajectories.
- static convert_trajectory_with_env(trajectory: TrajectoryRecord, conversion_env: MazeEnv | None) List[StructuredSpacesRecord]¶
Convert an episode trajectory record into an array of observations and actions using the given env.
- Parameters:
trajectory – Episode record to load
conversion_env – Env to use for conversion of MazeStates and MazeActions into observations and actions. Required only if state records are being loaded (i.e. conversion to raw actions and observations is needed).
- Returns:
Loaded observations and actions. I.e., a tuple (observation_list, action_list). Each of the lists contains observation/action dictionaries, with keys corresponding to IDs of structured sub-steps. (I.e., the dictionary will have just one entry for non-structured scenarios.)
- abstract pre_process(trajectory: TrajectoryRecord) TrajectoryRecord | List[TrajectoryRecord]¶
Preprocess a given trajectory before passing it through the wrapper stack.
In order to deal with pre-processing methods that create multiple trajectories from a single one (e.g. data augmentation by permutation of subsets) a single trajectory can be returned as well as a list of multiple trajectories.
- Parameters:
trajectory – The trajectory to preprocess.
- Returns:
The pre-processed trajectory or a list of multiple pre-processed trajectories.
- process(trajectory: TrajectoryRecord, conversion_env: MazeEnv | None) List[List[StructuredSpacesRecord]]¶
Convert an individual trajectory, by calling the pre_processing method followed by the convert_trajectory_with_env
- Parameters:
trajectory – Episode record to load.
conversion_env – Env to use for conversion of MazeStates and MazeActions into observations and actions. Required only if state records are being loaded (i.e. conversion to raw actions and observations is needed).
- Returns:
A list (corresponding to the trajectories) of lists (corresponding to the steps of a individual trajectory) of Structured Spaces Records. Each Structures Spaces Record holds a single environment step with all corresponding information such as sub-step observations and actions as well as rewards and actor ids.