SpacesTrajectoryRecord

class maze.core.trajectory_recording.records.trajectory_record.SpacesTrajectoryRecord(*args, **kwds)

Holds structured spaces records (i.e., raw actions and observations recorded during a rollout).

property actions

Convenience access to all structured action dicts from this trajectory.

property actions_dicts

Convenience access to all structured action dicts from this trajectory.

TODO: Does not support multi agent scenarios (where the substep (dict) key is the same for all agents)

This method is only used in alpha zero though.

is_done()bool

Convenience method for checking whether the end of this trajectory represents also the end of an episode.

stack()maze.core.trajectory_recording.records.structured_spaces_record.StructuredSpacesRecord

Stack the whole trajectory into a single structured spaces record.

Useful for processing whole fixed-length trajectories in a single batch.

classmethod stack_trajectories(trajectories: List[SpacesTrajectoryRecord])maze.core.trajectory_recording.records.trajectory_record.SpacesTrajectoryRecord

Stack multiple trajectories, keeping the time dimension intact.

All the trajectories should be of the same length. The resulting trajectory will have the same number of steps, each being a stack of the corresponding steps of the input trajectories.

Parameters

trajectories – Trajectories to stack.

Returns

Trajectory record of the same lenght, consisting of stacked structured spaces records.

total_reward()

Convenience method for calculating the total reward of a given trajectory.