Skip to content

Optional range-aware neuron split for signed inputs (ref #107) - #124

Merged
TLmaK0 merged 1 commit into
developfrom
issue-107-signed-split
Nov 25, 2026
Merged

TLmaK0 merged 1 commit into
developfrom
issue-107-signed-split

Conversation

@TLmaK0

@TLmaK0 TLmaK0 commented Nov 25, 2026

Copy link
Copy Markdown
Owner

What changes

  • MutationConfig::split_input_range: (f64, f64) with builder split_input_range(lo, hi) (it panics on an empty or non-finite range). It applies only to a split of a connection from an input. The [0,1] rule (5, −2.5) is rescaled to u = (s−lo)/(hi−lo): weight a/r into the new neuron, bias θ − a·lo/r, weight r·w out of it (clipped to weight_max), and lo·w added to the destination's bias (clipped to bias_max). Splits between CTRNN neurons keep the plain rule, because their signal σ(y+θ) is always in (0,1).
  • Defaults unchanged: (0, 1) is exactly the existing rule. Banco A is bit-identical and the long_run_identity hash is unchanged.
  • examples/split_probe.rs: evolves XOR with inputs presented in [0,1], [-1,1], [-3,3] and [-10,10], and compares 6 split rules (mean |Δoutput| on patterns and grid, % of splits that drop fitness).
  • xor_bench: new keys splitlo/splithi (split range) and inlo/inhi (present the XOR inputs as signed values).
  • Lunar lander JSON config exposes split_input_range (the default is unchanged).
  • The measurements are documented next to SPLIT_INPUT_WEIGHT in src/genome.rs.

Measurement (full table on #107)

  • Neutrality (split_probe 50 1 2 3 4 5), share of splits that drop fitness by > 0.5, current → range-aware: [-1,1] 21.3 % → 7.1 %, [-3,3] 9.6 % → 2.1 %, [-10,10] 6.4 % → 4.2 %. The [0,1] case is identical.
  • Search speed (xor_bench 50 500 init reset=1 seed=1/101/201/301), medians:
    • Banco A default 52/53/53/51 (unchanged).
    • Signed [-1,1]: current 45/50/48/45 vs range-aware 54/61/58/56 (worse).
    • [-3,3]: ≈ same.
    • [-10,10]: faster median (127 → ~80) but 188/200 solved vs 198/200.
  • Because a more neutral split is not a faster search here, the rule is opt-in. A fixed [-1,1] default was measured and rejected: it makes Banco A worse (59/59/61/63).

Verification

  • TDD: tests/split_input_range_tests.rs (defaults, rescaled weights and biases, neuron-source splits untouched, limits, mean output change on signed grids) and new tests/xor_bench_tests.rs cases. All were red before the change.
  • cargo fmt --check, cargo clippy --release --all-targets -- -D warnings (default and --all-features with the pyo3 stub), cargo build --release --examples, cargo check --features openai --examples, cargo test --release --no-fail-fast all pass, including long_run_identity_tests.

ref #107
Part of epic #55

🤖 Generated with Claude Code

A split of a connection from an input can now be fit to the input range
with MutationConfig::split_input_range (lo, hi): the [0, 1] rule is
rescaled to u = (s - lo) / (hi - lo), giving weight a/r into the new
neuron, bias θ - a·lo/r, weight r·w out of it and lo·w added to the bias
of the destination. Splits of connections between CTRNN neurons keep the
plain rule (their signal is σ(y + θ) in (0, 1)). The default (0, 1) is
the existing rule: results and the long-run identity hash are unchanged.

split_probe now evolves XOR with inputs presented as [lo, hi] for
[0,1], [-1,1], [-3,3], [-10,10] and compares six split rules (mean
|Δoutput| and share of splits that drop fitness). xor_bench gets keys
splitlo/splithi (split range) and inlo/inhi (signed XOR inputs); the
lunar lander config file exposes split_input_range.

The rescaled rule is much more neutral on signed inputs but is not a
faster search on XOR in [-1, 1], so it stays opt-in; measurements in
src/genome.rs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@TLmaK0
TLmaK0 merged commit b0cc678 into develop Nov 25, 2026
8 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.

1 participant