File tree Expand file tree Collapse file tree 2 files changed +31
-0
lines changed Expand file tree Collapse file tree 2 files changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -249,6 +249,22 @@ async def run(
249249 )
250250
251251 self .database .add (initial_program )
252+
253+ # Check if combined_score is present in the metrics
254+ if "combined_score" not in initial_metrics :
255+ # Calculate average of numeric metrics
256+ numeric_metrics = [
257+ v for v in initial_metrics .values ()
258+ if isinstance (v , (int , float )) and not isinstance (v , bool )
259+ ]
260+ if numeric_metrics :
261+ avg_score = sum (numeric_metrics ) / len (numeric_metrics )
262+ logger .warning (
263+ f"⚠️ No 'combined_score' metric found in evaluation results. "
264+ f"Using average of all numeric metrics ({ avg_score :.4f} ) for evolution guidance. "
265+ f"For better evolution results, please modify your evaluator to return a 'combined_score' "
266+ f"metric that properly weights different aspects of program performance."
267+ )
252268 else :
253269 logger .info (
254270 f"Skipping initial program addition (resuming from iteration { start_iteration } "
Original file line number Diff line number Diff line change @@ -463,6 +463,21 @@ async def run_evolution(
463463 for k , v in child_program .metrics .items ()
464464 ])
465465 logger .info (f"Metrics: { metrics_str } " )
466+
467+ # Check if this is the first program without combined_score
468+ if not hasattr (self , '_warned_about_combined_score' ):
469+ self ._warned_about_combined_score = False
470+
471+ if "combined_score" not in child_program .metrics and not self ._warned_about_combined_score :
472+ from openevolve .utils .metrics_utils import safe_numeric_average
473+ avg_score = safe_numeric_average (child_program .metrics )
474+ logger .warning (
475+ f"⚠️ No 'combined_score' metric found in evaluation results. "
476+ f"Using average of all numeric metrics ({ avg_score :.4f} ) for evolution guidance. "
477+ f"For better evolution results, please modify your evaluator to return a 'combined_score' "
478+ f"metric that properly weights different aspects of program performance."
479+ )
480+ self ._warned_about_combined_score = True
466481
467482 # Check for new best
468483 if self .database .best_program_id == child_program .id :
You can’t perform that action at this time.
0 commit comments