Skip to content

TrajectorySourceSelector ​

python
TrajectorySourceSelector(configuration: TrajectoryTrainingConfiguration | None, metrics: MetricsTracker, store: TrajectoryStore | None, *, allow_random_behaviour: bool = False) -> None

Chooses episode reset sources plus replay/policy/random behaviour from schedules.

Initialize the selector.

Parameters:

  • configuration (TrajectoryTrainingConfiguration | None) – Optional trajectory training configuration.
  • metrics (MetricsTracker) – Metrics tracker.
  • store (TrajectoryStore | None) – Shared trajectory store.
  • allow_random_behaviour (bool) – Whether whole-episode random behaviour is allowed.

Source

Methods ​

bc_filter ​

python
bc_filter() -> Callable[[TrajectoryReferenceRecording], bool] | None

Return the behaviour-cloning eligibility filter, when replay selection doesn't already enforce it.

Returns:

  • Callable[[TrajectoryReferenceRecording], bool] | None – The BC filter, or None when BC is disabled or replay selection already enforces it.

Source

choose ​

python
choose(step: int, *, reset_parameters: dict[str, int] | None = None) -> TrajectoryStartDecision

Choose how to start a new episode.

Parameters:

  • step (int) – The current global step.
  • reset_parameters (dict[str, int] | None) – Optional curriculum reset parameters for the episode; used to filter midpoint restarts to the curriculum's target partition (see midpoint.partition_reset_parameter).

Returns:

  • TrajectoryStartDecision – The chosen source decision.

Source

emit_metrics ​

python
emit_metrics(step: int) -> None

Emit trajectory-source metrics for one completed episode boundary.

Parameters:

  • step (int) – The global step for metrics.

Source

load_state_dict ​

python
load_state_dict(state: dict[str, Any]) -> None

Restore selector counters.

Parameters:

  • state (dict[str, Any]) – The serialised state.

Source

midpoint_start_episode_cell_counts_view ​

python
midpoint_start_episode_cell_counts_view() -> dict[TrajectoryKey, int]

Return the live midpoint-start episode-start counts without copying.

Returns:

  • dict[TrajectoryKey, int] – The live counter dictionary; callers must not mutate it.

Source

record_random_step ​

python
record_random_step() -> None

Record one executed random-controlled step.

Source

record_random_steps ​

python
record_random_steps(count: int) -> None

Record one or more executed random-controlled steps.

Parameters:

  • count (int) – Number of random-controlled steps.

Source

sampling_context ​

python
sampling_context(step: int) -> TrajectorySamplingContext

Build the sampling context for a selection call at the given step.

Parameters:

  • step (int) – The current global step.

Returns:

  • TrajectorySamplingContext – The sampling context, reflecting the live store statistics.

Source

state_dict ​

python
state_dict() -> dict[str, Any]

Serialise selector counters.

Returns:

  • dict[str, Any] – The serialised state.

Source