TrajectorySourceSelector
python
TrajectorySourceSelector(configuration: TrajectoryTrainingConfiguration | None, metrics: MetricsTracker, store: TrajectoryStore | None, *, allow_random_behaviour: bool = False) -> NoneChooses 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.
Methods
bc_filter
python
bc_filter() -> Callable[[TrajectoryReferenceRecording], bool] | NoneReturn the behaviour-cloning eligibility filter, when replay selection doesn't already enforce it.
Returns:
Callable[[TrajectoryReferenceRecording], bool] | None– The BC filter, orNonewhen BC is disabled or replay selection already enforces it.
choose
python
choose(step: int, *, reset_parameters: dict[str, int] | None = None) -> TrajectoryStartDecisionChoose 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.
emit_metrics
python
emit_metrics(step: int) -> NoneEmit trajectory-source metrics for one completed episode boundary.
Parameters:
step(int) – The global step for metrics.
load_state_dict
python
load_state_dict(state: dict[str, Any]) -> NoneRestore selector counters.
Parameters:
state(dict[str, Any]) – The serialised state.
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.
record_random_step
python
record_random_step() -> NoneRecord one executed random-controlled step.
record_random_steps
python
record_random_steps(count: int) -> NoneRecord one or more executed random-controlled steps.
Parameters:
count(int) – Number of random-controlled steps.
sampling_context
python
sampling_context(step: int) -> TrajectorySamplingContextBuild 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.
state_dict
python
state_dict() -> dict[str, Any]Serialise selector counters.
Returns:
dict[str, Any]– The serialised state.