FullEvaluationPolicy
gepa.strategies.eval_policy.FullEvaluationPolicy
Bases: EvaluationPolicy[DataId, DataInst]
Policy that evaluates all validation instances every time.
Methods:
get_eval_batch(loader: DataLoader[DataId, DataInst], state: GEPAState, target_program_idx: ProgramIdx | None = None) -> list[DataId]
Always return the full ordered list of validation ids.
Source code in gepa/strategies/eval_policy.py
text
def get_eval_batch(
self, loader: DataLoader[DataId, DataInst], state: GEPAState, target_program_idx: ProgramIdx | None = None
) -> list[DataId]:
"""Always return the full ordered list of validation ids."""
return list(loader.all_ids())get_best_program(state: GEPAState) -> ProgramIdx
Pick the program whose evaluated validation scores achieve the highest average.
Source code in gepa/strategies/eval_policy.py
text
def get_best_program(self, state: GEPAState) -> ProgramIdx:
"""Pick the program whose evaluated validation scores achieve the highest average."""
best_idx, best_score, best_coverage = -1, float("-inf"), -1
for program_idx, scores in enumerate(state.prog_candidate_val_subscores):
coverage = len(scores)
avg = sum(scores.values()) / coverage if coverage else float("-inf")
if avg > best_score or (avg == best_score and coverage > best_coverage):
best_score = avg
best_idx = program_idx
best_coverage = coverage
return best_idxget_valset_score(program_idx: ProgramIdx, state: GEPAState) -> float
Return the score of the program on the valset
Source code in gepa/strategies/eval_policy.py
text
def get_valset_score(self, program_idx: ProgramIdx, state: GEPAState) -> float:
"""Return the score of the program on the valset"""
return state.get_program_average_val_subset(program_idx)[0]