trinity.buffer.operators.filters.reward_filter module#

class trinity.buffer.operators.filters.reward_filter.RewardFilter(threshold: float = 0.0)[source]#

Bases: ExperienceOperator

Filter experiences based on the reward value.

Note: This filter assumes that the reward is already calculated and stored in the Experience object.

__init__(threshold: float = 0.0)[source]#
process(exps: List[Experience]) Tuple[List[Experience], dict][source]#

Filter experiences based on reward value.

class trinity.buffer.operators.filters.reward_filter.RewardSTDFilter(threshold: float = 0.0)[source]#

Bases: ExperienceOperator

Filter experiences based on the standard deviation of rewards within each group.

Note: This filter assumes that the reward is already calculated and stored in the Experience object.

__init__(threshold: float = 0.0)[source]#
process(exps: List[Experience]) Tuple[List[Experience], dict][source]#

Filter experiences based on reward std.

class trinity.buffer.operators.filters.reward_filter.InvalidRewardFilter[source]#

Bases: ExperienceOperator

Filters out experiences with invalid reward values.

Note: This operator assumes that rewards are already computed and stored in the Experience object.Any experience with a missing (None) or invalid (NaN) reward is removed to prevent low-quality data from entering the training pipeline.

process(exps: List[Experience]) Tuple[List[Experience], dict][source]#

Process a list of experiences and return a transformed list.

Parameters:

exps (List[Experience]) – List of experiences to process, which contains all experiences generated by the Explorer in one explore step.

Returns:

A tuple containing the processed list of experiences and a dictionary of metrics.

Return type:

Tuple[List[Experience], Dict]