tools/elm_bench/README: activation sweep (tanh / relu / step)

Full 60-config grid per activation on the same features, folds and seed, so
the three runs are directly comparable (act_sweep.log):

  tanh (default)  0.4218 mean per-fold RMSE   (constant 1.1406)
  relu            0.4338  (+2.8%)
  step            0.7476  (+77.3%)

The activation only matters where there is nonlinear structure to expose: on
base 6 and on scan-age alone all three agree to 0.0002 and are all worthless.
tanh stays the default because it is never worse, and because every other
number in this README was produced with it.

Also records why there is no RBF/gaussian option: g(b*||x - a||) reads the
distance to a centre in input space, so it needs centre + width parameters,
its own init and its own Thm 2.2 validation - a different node architecture,
not a different nonlinearity. It would buy nothing here anyway: the signal is
one linear term in beliefPredErr.
This commit is contained in:
2026-10-05 22:59:10 +02:00
parent fcaa7ba183
commit 8e6af386fc
+65
View File
@@ -1185,3 +1185,68 @@ finding — a single linear feature is.**
(b) hyper-parameter selection is on the reporting folds; (c) the whole bench
never tests the premise that predicting an opponent's aim error improves
*our* shots; (d) Dookious remains a genuine counterexample.
---
# ACTIVATION SWEEP (tanh / relu / step)
`bench_realistic.nim argv[2]` selects the hidden activation; features, folds,
grid and seed are unchanged, so the three runs are directly comparable.
Full grid, 5 round-group folds, best config per activation on ALL-21
(`act_sweep.log`).
| activation | best cfg | mean per-fold RMSE | pooled RMSE / MAE / medAE | Δ vs constant | vs tanh |
|---|---|---|---|---|---|
| **tanh** (default) | H=128 λ=1e-2 d=1.0 | **0.4218** | 0.4220 / 0.1824 / 0.1095 | **−0.7187** | — |
| relu | H=128 λ=1e2 d=1.0 | 0.4338 | 0.4340 / 0.1845 / 0.1171 | −0.7068 | +2.8% |
| step | H=128 λ=1e0 d=1.0 | 0.7476 | 0.7503 / 0.5181 / 0.3714 | −0.3930 | +77.3% |
| *constant baseline* | — | *1.1406* | *1.1463* | — | — |
Same picture on the smaller feature sets (mean per-fold RMSE):
| features | tanh | relu | step |
|---|---|---|---|
| ALL 21 | 0.4218 | 0.4338 | 0.7476 |
| believed base 7 | 0.7800 | 0.7840 | 0.8157 |
| belief geom only (base 6) | 1.1310 | 1.1308 | 1.1329 |
| scan-age only (4 features) | 1.1395 | 1.1395 | 1.1397 |
Reading:
* **The activation does not matter much, and where it does it is exactly where
the theory says.** On base 6 and on scan-age alone all three are within
0.0002 of each other and all three are worthless — those tasks have no
nonlinear structure for `g` to expose. The spread only opens up on the full
21-feature set, and there tanh wins by 2.8% over relu and 77% over step.
* **step loses badly (−77%) and relu is close to tanh, for one reason:** the
pre-activations are roughly symmetric about 0, so a step unit fires half the
time and emits a constant. Its Gram matrix is nearly rank-`L/2` and the
output weights needed to compensate are large. relu keeps one side of the
nonlinearity and is therefore much closer. This mirrors the interpolation
numbers in `modules/ELM/README.md` (20 samples in 20 nodes: tanh 5.2e-10,
relu 4.0e-12, step 2.3e-13 — all exact — but held-out MSE at λ=1e-8 is
1.1e-06 / 3.5e-02 / 8.4e-02, i.e. step is the one that fails to
generalise).
* **Practical consequence: keep tanh as the default.** The result does not
change either way (the ridge law in §4 reproduces the headline to within
1.6 points without any network at all), but tanh is never worse and is the
configuration every other number in this README was produced with.
### Why there is still no RBF/gaussian activation
Adding one is not a `g` swap. The classic RBF-ELM hidden unit is
`g(b·‖x − a‖)`: the activation reads the **distance to a centre in input
space**, so the hidden layer has to store centres plus per-node widths (the
width normally coming from the data, e.g. a mean over nearest-neighbour
distances). That changes what `W` and `hs` mean, how they are initialised, and
the conditioning argument behind `initElm`; it is a different node
architecture, not a different nonlinearity.
The short version of why it would not help here anyway: this task's signal is
one linear term (§5 — `label ≈ 0.8663 · beliefPredErr + 0.0418`, corr 0.92),
and a linear ridge already reproduces the ELM's headline to within 1.6 points.
A wider feature class buys nothing on a law that is already linear in one
variable; it would only buy more capacity to overfit the 40 round-groups.
Ship `0.87 × lead`, not a network.