Rewards#
Reward models for search-based protein design.
RewardModel combines the outputs of explicitly selected metrics into a scalar reward for one search checkpoint.
For specialized metrics (RF3, AF2, TMOL), see rfproteina.metrics.
- class rfproteina.rewards.RewardModel(rewards: Mapping[str, Any])#
Bases:
objectAggregate metric outputs for one search checkpoint.
- Parameters:
rewards – Map metric.output keys to weight, clip, and normalize_by settings. Values are clipped, divided by normalize_by, and multiplied by weight. Defaults are weight=1 and normalize_by=1, with no clipping.
The search strategy owns a separate instance for each checkpoint and runs the metrics explicitly listed there before aggregating their outputs.
- aggregate_metrics_output(metrics_output: dict[str, Any]) float#
Aggregate a metrics output dict into a scalar reward using configured weights.
Values are clipped per
clip_valuesbefore weighting. metrics_output is never mutated, so downstream reporting still sees the raw metric values.- Parameters:
metrics_output – Dictionary of metric results keyed by
"metric_name.output_key"(e.g."rf3.plddt").- Returns:
Weighted scalar reward, or
-infif a weighted key is missing.
