DiscreteReward
- class coba.primitives.DiscreteReward
A reward function mapping actions to rewards.
Constructors
- __init__(actions: Sequence[Action], rewards: Sequence[float], *, default: float = 0) None
- __init__(mapping: Mapping[Action, float], *, default: float = 0) None
Instantiate a DiscreteReward.
- Parameters:
actions – The actions to define rewards for.
rewards – The rewards for the given actions.
mapping – A mapping of actions to rewards.
default – The value to return for actions without mappings.
Methods
- __call__(action: str | Number | Sequence | Mapping) float
Get reward for action.
- Parameters:
action – An action taken.
- Returns:
Reward received for the action.