hybrid_aif.reference.raif.columns

hybrid_aif.reference.raif.columns#

R-AIF’s episode columns, as task columns of the engine’s Episode.

is_success is the goal predicate on the row’s observation, has_succeeded its running OR, can_self_imitate the expert flag that revise overwrites with the imitation mask, and pref_label is ρ. In Mountain Car the goal ends the episode, so raif_episode() writes cont = 1 − is_success.

Design: docs/design/amortization-p0-addendum.md §4.

Module Attributes

EXTRAS

The task columns and how a buffer pads them: the two flags hold their last value (a padded step is still "after the goal"), the weight and the label are zero where nothing was done or earned.

RECORDED

The recorded columns — the on-disk fixture format and the collect stream's arrays; pref_label is derived and never stored.

Functions

episode(obs, action, reward, *, is_first, ...)

An Episode from its columns, cast to the engine dtypes and checked.

raif_episode(*, obs, action, reward, ...[, ...])

An Episode from their recorded columns: cont = 1 − is_success, the four task columns in extras (ρ zero until revise.label()).

recorded_columns(ep)

The recorded columns of ep as numpy arrays, in RECORDED order.

succeeded(ep)

Whether the episode reached the goal: its final has_succeeded.

Classes

Array

Array base class for JAX

ColumnSpec

One task-specific column of an Episode.

Episode

One episode's per-step columns — the format the whole training side speaks.

hybrid_aif.reference.raif.columns.EXTRAS: dict[str, ColumnSpec] = {'can_self_imitate': ((), 'float32', 'zero'), 'has_succeeded': ((), 'bool', 'hold'), 'is_success': ((), 'bool', 'hold'), 'pref_label': ((), 'float32', 'zero')}#

The task columns and how a buffer pads them: the two flags hold their last value (a padded step is still “after the goal”), the weight and the label are zero where nothing was done or earned.

hybrid_aif.reference.raif.columns.RECORDED: tuple[str, ...] = ('obs', 'action', 'reward', 'is_success', 'has_succeeded', 'can_self_imitate', 'is_first', 'is_last')#

The recorded columns — the on-disk fixture format and the collect stream’s arrays; pref_label is derived and never stored.

hybrid_aif.reference.raif.columns.raif_episode(
*,
obs,
action,
reward,
is_success,
has_succeeded,
can_self_imitate,
is_first,
is_last,
pref_label=None,
)[source]#

An Episode from their recorded columns: cont = 1 − is_success, the four task columns in extras (ρ zero until revise.label()).

hybrid_aif.reference.raif.columns.recorded_columns(ep)[source]#

The recorded columns of ep as numpy arrays, in RECORDED order.

hybrid_aif.reference.raif.columns.succeeded(ep)[source]#

Whether the episode reached the goal: its final has_succeeded.