Skip to content

Boolean metrics: fix formatting and exclude from fitness; README badges#473

Merged
codelion merged 3 commits into
algorithmicsuperintelligence:mainfrom
adity982:agent/boolean-metric-formatting
Jul 18, 2026
Merged

Boolean metrics: fix formatting and exclude from fitness; README badges#473
codelion merged 3 commits into
algorithmicsuperintelligence:mainfrom
adity982:agent/boolean-metric-formatting

Conversation

@adity982

@adity982 adity982 commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Summary

bool is a subclass of int, so a naive isinstance(value, (int, float)) check silently treats True/False as 1.0/0.0. This PR fixes that in both places it bites.

This is not a hypothetical input: OpenEvolve's own evaluator emits timeout: True as a metric in several places (openevolve/evaluator.py).

1. Formatting (original PR)

  • Boolean metrics render as timeout=True instead of a meaningless timeout=1.0000.
  • Booleans are skipped when computing improvements — a flag flipping False → True is not a +1.0000 improvement.

2. Fitness math (added)

The same trap was still live in the scoring path, which matters considerably more than display. When an evaluation times out, evaluator.py returns:

{"error": 0.0, "timeout": True}

safe_numeric_average averaged that to 0.5, so a program that failed outright received a mid-range fitness and competed for survival in the database. Both safe_numeric_average() and get_fitness_score() now exclude booleans, and it correctly scores 0.0.

3. Dead code removal

controller.py defined module-level _format_metrics / _format_improvement that were never called (the controller imports the shared format_utils versions). Confusingly, those dead copies already contained the bool fix that the live path lacked. With format_utils corrected they are redundant, so they are removed.

4. README

Swap the PyPI downloads badge for the pepy.tech monthly badge, and drop the GitHub stars badge (GitHub already shows the star count).

Tests

tests/test_boolean_metrics.py covers formatting and fitness. The fitness assertions fail without the metrics_utils change (0.5 != 0.0), and the suite also pins that combined_score precedence, feature-dimension exclusion, and ordinary numeric metrics are unaffected.

Full suite: 413 passed.

Bumps version to 0.3.2.

@CLAassistant

CLAassistant commented Jul 17, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@codelion
codelion marked this pull request as ready for review July 18, 2026 12:26
…badges; bump 0.3.2

Builds on the boolean display fix in this PR. `bool` is a subclass of `int`, so the
naive `isinstance(value, (int, float))` check treats True/False as 1.0/0.0. The PR
fixed that for formatting; the same trap was still live in the FITNESS math, which
matters more:

- openevolve/utils/metrics_utils.py: exclude bools in both safe_numeric_average()
  and get_fitness_score(). openevolve/evaluator.py returns {"error": 0.0,
  "timeout": True} when an evaluation times out, which averaged to 0.5 - handing a
  program that failed outright a mid-range fitness and letting it compete for
  survival in the database. It now correctly scores 0.0.

- openevolve/controller.py: remove the module-level _format_metrics/_format_improvement
  helpers. They were dead code (defined, never called - the controller imports the
  shared format_utils versions), and confusingly they already contained the bool fix
  that the live code path lacked. With format_utils corrected they are redundant.

- tests/test_boolean_metrics.py: covers both display and fitness. The fitness cases
  fail without the metrics_utils change (0.5 != 0.0), and the suite pins that
  combined_score precedence, feature-dimension exclusion, and ordinary numeric
  metrics are unaffected.

README: swap the PyPI downloads badge for the pepy.tech monthly badge, and drop the
GitHub stars badge (GitHub already displays the star count).

Bump version to 0.3.2.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@codelion codelion changed the title Preserve boolean metric formatting Boolean metrics: fix formatting and exclude from fitness; README badges Jul 18, 2026
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@codelion
codelion merged commit 411fb59 into algorithmicsuperintelligence:main Jul 18, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants