Build a minimal throwaway prototype in Nim: a GA that evolves a small ANN (e.g., 10→4→1) to predict a simple periodic function (like sin(x) sampled with noise). Purpose: validate the GA→ANN→fitness pipeline works before wiring it into a bot. Tests: population init, fitness eval, selection, crossover, mutation, champion tracking. Throwaway — not production code, just proof the mechanism works.
Parent: #61
## Question
Build a minimal throwaway prototype in Nim: a GA that evolves a small ANN (e.g., 10→4→1) to predict a simple periodic function (like sin(x) sampled with noise). Purpose: validate the GA→ANN→fitness pipeline works before wiring it into a bot. Tests: population init, fitness eval, selection, crossover, mutation, champion tracking. Throwaway — not production code, just proof the mechanism works.
Final champion MSE: 0.000181 (fitness = -0.000181)
Average absolute prediction error: 0.0126 (well under 0.1 assert threshold)
Convergence clearly visible: MSE dropped from 0.095 (gen 0) to 0.0002 (gen 199) — monotonic improvement across all 200 generations
Commit:eee48de on research/goto-controller
## Resolution
**Built:** `prototypes/ga_gun_spike/ga_spike.nim` — 111-line pure-Nim GA that evolves a 10-4-1 tanh ANN (49 weights) to predict sin(x) from a sliding window.
**Pipeline validated:**
- Population init (200 individuals, random weights)
- Fitness eval (negative MSE on 50 random samples)
- Truncation selection (top 20%)
- Gaussian mutation on ALL weights (sigma=0.01), per #65 research
- Single elite preservation (best network unchanged)
- No crossover, per #65 research
- Champion tracking (fitness printed every 20 gens)
**Results:**
- Compiled and ran cleanly (`nim c -r`, Nim 2.2.4)
- Final champion MSE: **0.000181** (fitness = -0.000181)
- Average absolute prediction error: **0.0126** (well under 0.1 assert threshold)
- Convergence clearly visible: MSE dropped from 0.095 (gen 0) to 0.0002 (gen 199) — monotonic improvement across all 200 generations
**Commit:** `eee48de` on `research/goto-controller`
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Parent: #61
Question
Build a minimal throwaway prototype in Nim: a GA that evolves a small ANN (e.g., 10→4→1) to predict a simple periodic function (like sin(x) sampled with noise). Purpose: validate the GA→ANN→fitness pipeline works before wiring it into a bot. Tests: population init, fitness eval, selection, crossover, mutation, champion tracking. Throwaway — not production code, just proof the mechanism works.
Blocked by #65 — GA parameters from research inform the prototype's hyperparameters.
Resolution
Built:
prototypes/ga_gun_spike/ga_spike.nim— 111-line pure-Nim GA that evolves a 10-4-1 tanh ANN (49 weights) to predict sin(x) from a sliding window.Pipeline validated:
Results:
nim c -r, Nim 2.2.4)Commit:
eee48deonresearch/goto-controller