Gate question: can a ring-based label (a 2-D offset from the belief centre to
where a ray ring touches the enemy) be predicted from our own belief state?
extract_ring.py + bench_ring.nim answer it by MERGING the ring label into
samples_realistic.ndjson, so the ring label and the incumbent 1-D aim-error
label are scored on the SAME rows, the SAME features and the SAME round-group
folds. 8119 of 8676 DrussGT shot rows get a ring label.
Verdict: worse, not richer.
* The spike's headline is an artifact. The belief is already accurate to
under 3 px, so a belief-anchored ring touches the enemy on its FIRST ray
step: ringK = 1.0000 for all 172723 extracted events. The "100% at power
<= 1.5, 0.2% at power 3.0" pattern is just whether 1 * bulletSpeed fits
inside the +-18 px belief-error ball. The literal ring label is the 1-tick
belief extrapolation error, clipped to BotRadius.
* Same-tick it scores better than the 1-D label (ELM/const 0.2628 vs 0.3629)
but a single feature, beliefTgtLatVel, already gets -71.8 of the -73.7
points: the model is re-deriving beliefTgtLatVel * age / beliefDist, i.e.
its own inputs.
* Under --prev it collapses to ratio 0.9819 (-1.8%). It depends MORE on the
same-tick assumption than the 1-D label (-63.7% -> -1.0%), not less.
* Repaired (--kintercept: k = round(believed range / bullet speed), mean k 42,
no clipping, 60 px spread) the label is well posed and completely
unpredictable: best feature +0.5%, best ELM -0.4%, best |corr| 0.09.
So: the belief-extrapolation error at intercept time is not a function of what
we believed, it is the opponent's unmodelled acceleration. Do not ship a ring
label. common_libs/guns/waveelm.nim is the right shape for the same idea and
is a different thing: it fires the ring from the SHOOTER, so the ring measures
an interception radius and bearing and the ELM learns a bias correction to it.
1474 lines
77 KiB
Markdown
1474 lines
77 KiB
Markdown
# ELM aim-error benchmark — "can we beat DrussGT's aim prediction?"
|
||
|
||
**Question:** given the battle state DevControlBot can see, can an ELM predict the
|
||
aim error DrussGT makes when it fires at us, well enough to shoot *its* shots
|
||
more accurately?
|
||
|
||
**Short answer: barely, and only through an oracle feature. See VERDICT.**
|
||
|
||
Run date: 2025-10-04. Nim 2.2.4. Full output: `run.log`.
|
||
|
||
## Reproduce
|
||
|
||
```bash
|
||
cd tools/elm_bench
|
||
# dataset already extracted (samples.ndjson, 8676 shots). To re-extract from
|
||
# data/drussgt_raw/*.battle.gz:
|
||
python3 extract.py
|
||
# compile + run (≈3 min total: 3 × 60 ELM configs × 5 folds)
|
||
nim c -r --path:../../DevControlBot_garage/DevControlBot bench.nim | tee run.log
|
||
```
|
||
|
||
## Dataset
|
||
|
||
`samples.ndjson`, 8676 samples, 40 round-groups (`devcontrol:<round>`,
|
||
`oscillator:<round>`), 8579 of them shots by **DrussGT** at DevControlBot.
|
||
One line per `BulletFiredEvent`. Features are the shooter's view.
|
||
|
||
### Label
|
||
|
||
`label = wrap(bearingIdeal - radians(bullet.direction))`, where `bearingIdeal`
|
||
is the true intercept bearing of the target at fire time, computed from the
|
||
observer stream (ground truth) with one fixed-point iteration on
|
||
`t_f = d / (power*10)`. Positive = the shooter aimed low/clockwise relative to
|
||
the ideal.
|
||
|
||
### Features (all as recorded by `extract.py`)
|
||
|
||
| group | features |
|
||
|---|---|
|
||
| base 7 | `dist`, `sin(relBearing)`, `cos(relBearing)`, `tgtSpeed`, `tgtLatVel` (lateral target velocity w.r.t. LOS), `bulletSpeed`, `invDist` |
|
||
| scan | `sinceScan` (turns since the **shooter last scanned us**), `logScan`, `everScanned` |
|
||
| turret | `gunHeat`, `power` |
|
||
| lagged | `dt` (ticks since the previous shot in the round), `disp`, `dispSpeed`, `dispLat` (speed×dt proxies), `turn` (target heading change) |
|
||
| intercept geometry | `losRate`, `tof`, `closing` |
|
||
| context | `round`, `tick` |
|
||
|
||
`relBearing` = true ideal bearing − shooter's heading. **This is an oracle
|
||
feature** (it uses ground-truth target velocity, not the shooter's scan
|
||
history). See VERDICT.
|
||
|
||
## Splits
|
||
|
||
5-fold **by round-group**, round-robin over groups. Consecutive ticks are near
|
||
duplicates, so random splits leak. A second, shifted assignment (`offset +3`) is
|
||
used as a robustness check. No hyper-parameter is selected on data the model is
|
||
scored on except inside the sweep itself (sweeps are reported per feature set,
|
||
and the winner's config is re-scored under the shifted split).
|
||
|
||
## Label distribution
|
||
|
||
```
|
||
n = 8676 mean = 0.1136 rad (6.51 deg) std = 1.1462 rad (65.67 deg)
|
||
p1 -165.8 p5 -111.2 p10 -69.4 p25 -18.9 p50 +0.4 p75 +29.5 p90 +102.1 p95 +133.7 p99 +168.6 deg
|
||
|label| > 22.5 deg: 4417 samples (50.9%) carrying 98.7% of total squared deviation
|
||
```
|
||
|
||
Bimodal-ish: a tight core around 0 and a very heavy two-sided tail out to ±180°.
|
||
Half the dataset is beyond ±22.5° and that half owns essentially all the MSE.
|
||
|
||
## Baselines (mean ± sd over the 5 folds)
|
||
|
||
| model | RMSE |
|
||
|---|---|
|
||
| (a) constant mean | **1.1406 ± 0.0330** |
|
||
| (b) distance-binned mean | 1.1408 ± 0.0334 |
|
||
| (c) OLS on 7 geometric features | 1.1487 ± 0.0959 |
|
||
|
||
Pooled over the held-out rows: constant 1.1463 / 0.7958 / 0.4284
|
||
(RMSE / MAE / median-abs-error); OLS-7 1.1644 / 0.8006 / 0.4185.
|
||
The originals reproduce exactly.
|
||
|
||
## (A) Feature ablation — ridge, 5-fold by round-group
|
||
|
||
| feature set | RMSE | MAE | medAE |
|
||
|---|---|---|---|
|
||
| baseline 7 (geometry) | 1.1644 | 0.8006 | 0.4185 |
|
||
| + sinceScan | 1.1635 | 0.8010 | 0.4219 |
|
||
| + our gunHeat/power | 1.1644 | 0.8006 | 0.4185 |
|
||
| + lagged displacement | 1.1621 | 0.7999 | 0.4229 |
|
||
| + intercept geometry | 1.1648 | 0.8030 | 0.4279 |
|
||
| + round/tick context | 1.1656 | 0.8001 | 0.4196 |
|
||
| + scan + turret | 1.1635 | 0.8010 | 0.4219 |
|
||
| + scan + lag | 1.1607 | 0.8000 | 0.4257 |
|
||
| ALL 22 | 1.1578 | 0.7978 | 0.4246 |
|
||
|
||
**Every addition is within noise of the constant, and the full 22-feature model
|
||
is still worse than it (1.1421 vs 1.1406 per-fold).** Single-feature ridges are
|
||
individually indistinguishable from the constant:
|
||
|
||
| feature | RMSE alone | (const 1.1406) |
|
||
|---|---|---|
|
||
| closing | 1.1390 | |
|
||
| turn | 1.1395 | |
|
||
| disp | 1.1397 | |
|
||
| everScanned | 1.1402 | |
|
||
| tof | 1.1403 | |
|
||
| **sinceScan** | **1.1405** | ← the "key suspect" is not a suspect, it is noise |
|
||
|
||
**Time-since-last-scan carries no signal at all** (1.1405 vs 1.1406), alone or
|
||
added. DrussGT's staleness is not what drives its error.
|
||
|
||
## (B) ELM sweep — batched (`refitEvery = 0`, one `refit()` after the batch)
|
||
|
||
60 configs (hiddenDim {16,32,64,128} × lambda {1e-6,1e-4,1e-2,1,100} × decay
|
||
{1.0,0.99,0.95}) × 5 folds × 3 feature sets. Whole sweep: 3 min. Top of each:
|
||
|
||
| features | H | lambda | decay | per-fold RMSE | mean |
|
||
|---|---|---|---|---|---|
|
||
| base 6 | 128 | 1e-6 | 1.0 | 0.9404 0.9187 1.0794 0.8597 0.9548 | **0.9506** |
|
||
| base 6 | 128 | 1e-4 | 1.0 | 0.9630 0.9413 1.1227 0.8745 0.9769 | 0.9757 |
|
||
| base 6 | 64 | 1e-6 | 1.0 | 1.0267 1.0123 1.1929 0.9385 1.0437 | 1.0428 |
|
||
| base 7 | 128 | 1e-6 | 1.0 | 1.0073 0.9927 1.1648 0.9409 1.0357 | 1.0283 |
|
||
| base 7 | 128 | 1e-2 | 1.0 | 1.0392 1.0361 1.2285 0.9404 1.0368 | 1.0562 |
|
||
| ALL 22 | 128 | 1e-2 | 1.0 | 1.1007 1.0897 1.2765 0.9502 1.0646 | 1.0963 |
|
||
|
||
(`base 6` = base 7 minus `tgtLatVel`. Anything with decay < 1.0 is far worse
|
||
— forgetting is not what you want for this task.)
|
||
|
||
The best configuration is **base 6, H=128, lambda=1e-6, decay=1.0**. Adding the
|
||
15 extra features (ALL 22) makes it *worse* — the extra features are noise and
|
||
the bigger input hurts.
|
||
|
||
### Honest paired check (best config vs constant, same folds)
|
||
|
||
```
|
||
fold 0: ELM 0.9404 const 1.1551 delta -0.2147
|
||
fold 1: ELM 0.9187 const 1.1747 delta -0.2559
|
||
fold 2: ELM 1.0794 const 1.1605 delta -0.0811
|
||
fold 3: ELM 0.8597 const 1.0805 delta -0.2209
|
||
fold 4: ELM 0.9548 const 1.1321 delta -0.1773
|
||
mean delta -0.1900 rad (sd 0.0599, better on all 5 folds)
|
||
```
|
||
|
||
Under the shifted group→fold assignment, same model, no reselection:
|
||
ELM 0.9506 vs constant 1.1406, delta −0.1900, better on every fold.
|
||
|
||
### Where the gain lives (same cfg, mean RMSE over folds)
|
||
|
||
| features | RMSE | vs constant |
|
||
|---|---|---|
|
||
| base 6 | 0.9506 | −0.190 |
|
||
| base 7 | 1.0283 | −0.112 |
|
||
| base 6 **without** sin/cos(relBearing) | 1.1325 | −0.008 |
|
||
| only sin/cos(relBearing) | 1.1400 | −0.001 |
|
||
| only distance | 1.1369 | −0.004 |
|
||
| only speed/LOS | 1.1376 | −0.003 |
|
||
|
||
**100% of the signal flows through `sin/cos(relBearing)`** — the oracle
|
||
intercept-bearing offset. Drop the oracle and the model is indistinguishable
|
||
from a constant. Conversely `tgtLatVel` is actively harmful (+0.078 RMSE).
|
||
|
||
## (D) Robust metrics — best model, pooled held-out
|
||
|
||
| model | RMSE | MAE | median abs err |
|
||
|---|---|---|---|
|
||
| constant | 1.1463 | 0.7958 | 0.4284 |
|
||
| **ELM base 6** | **0.9602** | **0.6687** | 0.4285 |
|
||
|
||
RMSE −16%, MAE −16%, **median unchanged**. Tail breakdown under the constant:
|
||
core (|label| ≤ 22.5°) n=4259 MAE 0.183; tail n=4417 MAE 1.387 — 50.9% of rows,
|
||
88.7% of all absolute error. The ELM improves the tail-heavy average and does
|
||
nothing for the typical shot. That is the honest picture: it is not "fewer wild
|
||
misses", it is a small shrinkage of the average magnitude.
|
||
|
||
## Learning curve (best cfg, held-out = fold 0, 2041 rows)
|
||
|
||
| train n | RMSE | MAE | medAE | const RMSE |
|
||
|---|---|---|---|---|
|
||
| 50 | 33.53 | 27.02 | 26.84 | 1.1551 |
|
||
| 100 | 7.86 | 5.29 | 3.23 | 1.1551 |
|
||
| 200 | 7.42 | 4.37 | 2.37 | 1.1551 |
|
||
| 400 | 3.03 | 2.06 | 1.73 | 1.1551 |
|
||
| 800 | 1.263 | 0.847 | 0.398 | 1.1551 |
|
||
| 1600 | 0.994 | 0.691 | 0.439 | 1.1551 |
|
||
| 3200 | 0.992 | 0.696 | 0.461 | 1.1551 |
|
||
| 6400 | 0.941 | 0.658 | 0.415 | 1.1551 |
|
||
| all 6635 | 0.940 | 0.659 | 0.421 | 1.1551 |
|
||
|
||
Flat from 1600 samples on: **more data does not help.** Whatever the model is
|
||
learning is a low-dimensional, easily-saturated effect, not a subtle function.
|
||
|
||
## (C) Variance decomposition
|
||
|
||
```
|
||
total label variance 1.31379
|
||
held-out MSE, constant mean 1.30201 (0.90% explained)
|
||
held-out MSE, distance-binned 1.30258
|
||
held-out MSE, OLS base 7 1.32875 (worse than constant)
|
||
held-out MSE, ridge + sinceScan 1.30192
|
||
held-out MSE, ridge ALL 22 1.31356 (worse than constant)
|
||
held-out MSE, best ELM (base 6) 0.90884 (30.8% explained)
|
||
--> residual after best ELM 69.2%
|
||
```
|
||
|
||
The global mean explains ~1%. Every linear model explains ~0%. The best ELM
|
||
explains **31%**, i.e. it leaves 69% of the label variance untouched. Three
|
||
quarters of the story is not in these features at all.
|
||
|
||
## VERDICT
|
||
|
||
**Can an ELM learn to predict aim error against DrussGT? Partly — but not in a
|
||
way we can use.**
|
||
|
||
What is true:
|
||
|
||
1. **Yes, there is a real, reproducible ~17% RMSE / 16% MAE gain over the
|
||
constant**, on 5/5 folds and under a shifted split, at H=128, lambda=1e-6,
|
||
decay=1.0. That is not a fluke of the fold split.
|
||
2. **But the entire gain comes from `sin/cos(relBearing)`.** `relBearing` is the
|
||
*true* intercept bearing minus the shooter's heading — computed in
|
||
`extract.py` from the observer's ground-truth target velocity. No bot has
|
||
that. Remove it and the model scores 1.1325 vs the constant's 1.1406:
|
||
nothing.
|
||
3. **Time-since-last-scan — the prime suspect — carries zero signal**
|
||
(1.1405 alone, and adding it never helps). Staleness is not the story.
|
||
4. **Everything else — gunHeat, power, tof, closing, lagged displacement,
|
||
turn, round, tick — carries nothing.** Ridge on all 22 features is *worse*
|
||
than a constant, and feeding all 22 to the ELM makes it worse too. Geometry
|
||
has essentially no explanatory power here.
|
||
5. **69% of the label variance is unexplained even by the best model**, and the
|
||
learning curve is flat past 1600 samples.
|
||
6. **The median error does not move at all** (0.4284 → 0.4285). Only the
|
||
average magnitude improves.
|
||
|
||
### The wall
|
||
|
||
The label is `trueInterceptBearing − bulletDirection`, and `bulletDirection` is
|
||
the *shooter's* actual turret bearing. So the label is dominated by
|
||
**the opponent's own turret lag and its stale mental model of us**, not by
|
||
anything about our geometry. Half the shots miss by more than 22.5° in
|
||
*completely uncorrelated directions* (the ±180° tail is symmetric). What a
|
||
model can learn is the weak, learnable residue: when the shooter's stale
|
||
intercept happens to be far off, its turret hasn't caught up — that is what the
|
||
oracle `relBearing` exposes. Without an oracle bearing, that residue is not
|
||
observable to us.
|
||
|
||
So: **do not build this.** There is nothing here to shoot with. If the
|
||
hypothesis that the 31% is an artifact of the oracle feature is wrong, the way
|
||
to settle it is a second capture in which `relBearing` is computed from the
|
||
shooter's *last scanned* position instead of ground truth, and re-running this
|
||
benchmark. My expectation is that number lands on ~1.13, i.e. the constant.
|
||
|
||
### Note on the engine
|
||
|
||
The original 7h51m hang was the `refitEvery` semantics bug in
|
||
`DevControlBot_garage/DevControlBot/modules/ELM/elm.nim`: `<= 1` meant "refit on
|
||
every `train()`", so a benchmark passing `refitEvery: 0` for batching instead
|
||
refit the whole ~7000-sample buffer 7000 times per fold. `refitEvery == 0` now
|
||
means "never refit in `train()`; the caller calls `refit()` once". The whole
|
||
180-config × 5-fold sweep above runs in 3 minutes.
|
||
|
||
## Files
|
||
|
||
| file | role |
|
||
|---|---|
|
||
| `extract.py` | labels + features from `data/drussgt_raw/*.battle.gz` |
|
||
| `samples.ndjson` | 8676 extracted samples |
|
||
| `bench.nim` | the whole benchmark (baselines, ablation, sweep, learning curve, decomposition) |
|
||
| `run.log` | output of the run reported here |
|
||
---
|
||
|
||
# Realistic-feature experiment
|
||
|
||
**Question being settled:** the VERDICT above left one thing open — "the −16% was
|
||
an artifact of the oracle `relBearing`; the honest number with observable
|
||
features may be ~1.13, i.e. the constant." This section runs that experiment.
|
||
|
||
Run date: 2025-10-04 (second pass). Nim 2.2.4. Logs: `run_realistic.log`,
|
||
`analysis_realistic.log`.
|
||
|
||
```bash
|
||
cd tools/elm_bench
|
||
python3 extract_realistic.py # -> samples_realistic.ndjson
|
||
python3 extract_realistic.py samples_realistic_prev.ndjson # leakage-audit variant
|
||
nim c -r --path:../../DevControlBot_garage/DevControlBot bench_realistic.nim | tee run_realistic.log
|
||
python3 analyse_realistic.py | tee analysis_realistic.log
|
||
```
|
||
|
||
## 0. Was `relBearing` in `extract.py` an oracle? Yes.
|
||
|
||
`extract.py`, inside the `BulletFiredEvent` loop, after building `T` (the
|
||
target's **true** `botStates` entry) and `vel` (the **true** per-tick
|
||
displacement of that entry):
|
||
|
||
```python
|
||
ideal = math.atan2(Tp[1] - S[1], Tp[0] - S[0])
|
||
...
|
||
relb = wrap(ideal - math.radians(sb["direction"]))
|
||
```
|
||
|
||
`Tp` is `T + vel*t_f` with `vel` taken from the observer stream. Both `T` and
|
||
`vel` are ground truth at the fire tick. So `relBearing = trueIdealBearing −
|
||
shooterHeading` — the exact intercept solution, including the target's true
|
||
velocity. No bot has it. **Confirmed oracle**, and its own docstring says so.
|
||
|
||
## 1. The realistic feature set (`extract_realistic.py` → `samples_realistic.ndjson`)
|
||
|
||
Same 8676 `BulletFiredEvent`s, **byte-identical labels** (verified: max |Δlabel|
|
||
= 0.0 over all rows), same 40 round-groups, same 5-fold round-group split.
|
||
Every feature comes from the shooter's own state or its `ScannedBotEvent`
|
||
history. The target's true position/velocity at fire time is read *only* to
|
||
compute the label.
|
||
|
||
Notation: last scan of the target by the shooter is `(t_s, P_s, h_s, s_s)`
|
||
(position, heading, speed as reported in the `ScannedBotEvent`); the one before
|
||
it is `(t_0, P_0, ·)`. `age = t_fire − t_s`. Estimated velocity
|
||
`v_est = (P_s − P_0)/(t_s − t_0)` (zeros if no prior scan). Dead-reckoned
|
||
position `P_est = P_s + v_est·age`.
|
||
|
||
| feature | definition |
|
||
|---|---|
|
||
| `beliefScanAge` | ticks since the shooter's last scan of the target — the key staleness quantity |
|
||
| `beliefEverScanned` | 1 if any scan exists (here always 1; 0 rows never scanned) |
|
||
| `beliefScanGap` | ticks between the last two scans |
|
||
| `beliefDist` | `|P_est − S|` — believed range |
|
||
| `beliefRelBearing` | `wrap(atan2(P_est − S) − shooterHeading)` — believed bearing |
|
||
| `sinRel/cosRel` | sin/cos of the above (the oracle `sinRel/cosRel` rebuilt) |
|
||
| `beliefTgtSpeed` | `|v_est|` |
|
||
| `beliefTgtLatVel` | lateral component of `v_est` w.r.t. the believed LOS |
|
||
| `beliefClosing` | radial component of `v_est` (closing-positive) |
|
||
| `beliefLosRate` | `latVel / beliefDist` |
|
||
| `beliefTof` | `beliefDist / bulletSpeed` |
|
||
| `beliefPredRelBearing` | the shooter's own intercept solution: one fixed-point iteration on `v_est·tof` from `P_est`, expressed relative to its heading — i.e. the lead it believes it must apply |
|
||
| `beliefPredErr` | `wrap(beliefPredRelBearing − beliefRelBearing)` = **the lead angle the shooter believes it needs**. This is the one that matters. |
|
||
| `sinPred/cosPred` | sin/cos of `beliefPredRelBearing` |
|
||
| `ownHeading`, `ownGunBearing`, `ownX/Y`, `ownSpeed`, `gunHeat`, `power`, `bulletSpeed` | the shooter's own true state — legitimately available to any bot |
|
||
| `beliefDisp` | how far the shooter itself has moved since the scan |
|
||
| `round`, `tick` | context |
|
||
|
||
`oracleDist` / `oracleRelBearing` are written to the file for reference only
|
||
and are **never** used as features anywhere below.
|
||
|
||
Sanity note on what "observable" means here: this is the **shooter's** view, as
|
||
in `extract.py` and as the task specifies. A bot always has its own state and
|
||
its own scan history. It does *not* mean DevControlBot can see DrussGT's radar.
|
||
|
||
## 2. Baselines (5-fold by round-group; mean ± sd of per-fold RMSE)
|
||
|
||
| model | RMSE |
|
||
|---|---|
|
||
| (a) constant mean | 1.1406 ± 0.0330 |
|
||
| (b) believed-distance-binned mean | 1.1409 ± 0.0333 |
|
||
| (c) ridge on the 7 believed-geometry features | 0.9339 ± 0.0246 |
|
||
|
||
Pooled held-out: constant 1.1463 / 0.7958 / 0.4284 (RMSE/MAE/medianAE),
|
||
distance-binned 1.1467 / 0.7967 / 0.4287. Baselines are as strong as before —
|
||
nothing was weakened.
|
||
|
||
## 3. (A) Ridge ablation (pooled held-out)
|
||
|
||
| feature set | RMSE | MAE | medAE |
|
||
|---|---|---|---|
|
||
| belief geometry only (6: dist, invDist, sin/cosRel, speed, bulletSpd) | 1.1448 | 0.7921 | 0.4428 |
|
||
| + scan age | 0.9346 | 0.6229 | 0.3564 |
|
||
| + believed intercept geometry | **0.4379** | 0.1714 | 0.1089 |
|
||
| + our own state (gunHeat/power/ownSpeed) | 0.9347 | 0.6231 | 0.3553 |
|
||
| + context (round/tick/disp) | 0.9342 | 0.6228 | 0.3546 |
|
||
| + scan + intercept | 0.4381 | 0.1715 | 0.1088 |
|
||
| ALL 21 | 0.4383 | 0.1720 | 0.1089 |
|
||
|
||
Single-feature ridges (constant 1.1406):
|
||
|
||
| feature | RMSE | | feature | RMSE |
|
||
|---|---|---|---|---|
|
||
| **beliefPredErr** | **0.4398** | | scanAge | 1.1405 |
|
||
| tgtLatVel | 0.9358 | | logScan | 1.1404 |
|
||
| closing | 1.1311 | | everScanned | 1.1406 |
|
||
| tof | 1.1394 | | scanGap | 1.1406 |
|
||
| power | 1.1400 | | sinRel / cosRel / dist | 1.1406 |
|
||
| tgtSpeed | 1.1403 | | sinPred | 1.1409 |
|
||
| ownSpeed | 1.1411 | | cosPred | 1.1518 |
|
||
| losRate | 1.2363 (worse) | | | |
|
||
|
||
The whole effect is one feature, and it is not a bearing *offset* — it is the
|
||
**shooter's own predicted lead angle**.
|
||
|
||
## 4. (B) ELM sweep (H{16,32,64,128} × λ{1e-6,1e-4,1e-2,1,100} × decay{1,0.99,0.95}, 60 configs × 5 folds, batched `refitEvery=0`)
|
||
|
||
Top of ALL-21: H=128, λ=1e-2, decay=1.0 → 0.3582 0.4757 0.4153 0.4277 0.4323,
|
||
**mean 0.4218**. Same shape as the oracle run: decay < 1.0 is catastrophic
|
||
(worst configs ≈ 3–9 RMSE), bigger H is better, λ is nearly irrelevant in
|
||
1e-6…1e-2.
|
||
|
||
| features | best cfg | mean per-fold RMSE | pooled RMSE/MAE/medAE | Δ vs constant | better folds |
|
||
|---|---|---|---|---|---|
|
||
| ALL 21 | H=128 λ=1e-2 d=1.0 | 0.4218 | 0.4220 / 0.1824 / 0.1095 | **−0.7187** | 5/5 |
|
||
| believed base 7 | H=128 λ=1e-6 d=1.0 | 0.7800 | 0.7815 / 0.5034 / 0.3084 | −0.3606 | 5/5 |
|
||
| belief geom only (base 6) | H=128 λ=1e-4 d=1.0 | 1.1310 | 1.1372 / 0.7854 / 0.4429 | −0.0096 | 5/5 |
|
||
| scan-age only (4 features) | H=128 λ=1e-6 d=1.0 | 1.1395 | — | −0.001 | — |
|
||
|
||
**ELM RMSE 0.4220 vs constant 1.1463 = −63%.** Fold-shift robustness (group→fold
|
||
offset +3, no reselection): ELM 0.4218 vs const 1.1406, delta −0.7187 on every
|
||
fold (−0.745 −0.653 −0.700 −0.797 −0.699). Learning curve (fold 0 held out):
|
||
50 → 1.53, 200 → 0.50, 800 → 0.45, 1600 → 0.43, 3200 → 0.37, all 6635 → 0.3582.
|
||
Unlike the oracle run this curve **keeps improving** with data.
|
||
|
||
## 5. What the model actually found
|
||
|
||
Ridge `label ≈ 0.8663 · beliefPredErr + 0.0418` (corr 0.9235, held-out RMSE
|
||
0.4400 with that single feature). Read literally:
|
||
|
||
> DrussGT aims at roughly `currentBearing + 0.13 × (the lead it should have
|
||
> applied)`. It applies about **one eighth** of the correct lead.
|
||
|
||
That is why the oracle experiment looked weak: it handed the model the *correct*
|
||
intercept bearing and asked it to predict the residual, a nearly-unlearnable
|
||
noise floor (0.96 vs 1.15). The real structure is the opposite — the model's job
|
||
is to compute the shooter's own lead from its own scan, which is a smooth,
|
||
deterministic function of geometry it fully observes.
|
||
|
||
The label is dominated by `wrap(idealIntercept − gunBearing)`, and the gun is
|
||
pointing at a nearly-lead-free bearing. `corr(label, wrap(relBearing − gunBearing))`
|
||
= −0.03: the error is *not* turret lag, it is the missing lead.
|
||
|
||
### Availability at OUR fire time
|
||
|
||
`beliefPredErr` is computed by the shooter from *its* belief about us. Can we
|
||
compute it? Mostly yes, and that is the practical part:
|
||
|
||
- it needs the believed range (we track DrussGT's position from **our** scans),
|
||
- our own lateral velocity (we know our own state exactly),
|
||
- DrussGT's bullet speed (public: it is in every `BulletFiredEvent` we receive),
|
||
- and DrussGT's own scan staleness — which we do *not* know. That is the one
|
||
term we must assume. It is a small assumption here: **97.3% of DrussGT's
|
||
shots happen on the same tick it last scanned us** (scan-age histogram
|
||
`{0: 8444, 1: 232}` — it shoots on scan), so the constant we would have to
|
||
guess is "0 ticks", and it is right 97% of the time.
|
||
|
||
So the buildable version is: predict the opponent's aim error as
|
||
`0.87 × lead(angle we subtend to it, our own lateral velocity, its bullet
|
||
speed)`, with a single fudge constant for its assumed staleness.
|
||
|
||
### Leakage audit
|
||
|
||
The whole thing hinges on the shooter's scan in the *same tick* as the shot. Is
|
||
that an event-ordering artifact of the recording, or does the bot really have it?
|
||
Test (`extract_realistic.py` with strictly-prior scans only,
|
||
`samples_realistic_prev.ndjson`, all 8676 rows fall back to a scan at
|
||
`t < t_fire`):
|
||
|
||
| feature set | same-tick scan allowed | strictly-prior scan only |
|
||
|---|---|---|
|
||
| constant | 1.1462 | 1.1462 |
|
||
| predErr alone | **0.4400** | 1.1392 |
|
||
| our-state only | 0.9314 | 1.1413 |
|
||
| our-state + predErr | **0.4376** | 1.1383 |
|
||
| ALL realistic (20) | 0.4383 | 1.1388 |
|
||
|
||
With a stale belief the effect is **gone**. So the −63% is entirely "DrussGT
|
||
scans us and fires in the same tick", which is what its behaviour log shows and
|
||
what a Tank Royale bot genuinely has (commands issued in a tick execute in that
|
||
tick — otherwise the 3-tick gun-heat/cooldown model would not line up). It is
|
||
observable, not leaked. But it is also **all-or-nothing**: one tick of
|
||
staleness and there is nothing left. That is the fragility to keep in mind.
|
||
|
||
## 6. (E) Scan-age conditional analysis
|
||
|
||
| bucket (ticks since the shooter scanned us) | n | frac | label mean | label sd | RMSE within bucket | medAE within bucket |
|
||
|---|---|---|---|---|---|---|
|
||
| 0 (fresh scan, same tick) | 8444 | 97.3% | 0.1065 | 1.1515 | 1.1515 | 0.4329 |
|
||
| 1 | 232 | 2.7% | 0.3754 | 0.8939 | 0.8939 | 0.4693 |
|
||
| ≥2 | 0 | 0% | — | — | — | — |
|
||
|
||
Held-out scan-age-bucketed mean predictor: **1.1458**, versus the constant's
|
||
1.1406 — i.e. knowing how stale the shooter's belief is buys nothing on its own.
|
||
|
||
Interpretation: staleness is not a graded driver of the shooter's error. A
|
||
fresh scan is the norm and produces the full ±180°-tailed error distribution; a
|
||
one-tick-old belief is a small, slightly quieter population. The error is not
|
||
"the shooter is working from stale data" — it is "the shooter does not lead its
|
||
target, fresh or not". (Only two age buckets exist, so this is a two-point
|
||
statement, not a curve.)
|
||
|
||
## 7. FINAL VERDICT
|
||
|
||
**Conclusion (c), mixed — and the useful half is much bigger than the oracle run
|
||
suggested.**
|
||
|
||
1. **The oracle −16% was indeed an artifact of how it was used.** Remove true
|
||
state and the *same* feature families (bearing, distance, speed, intercept
|
||
geometry) collapse onto the constant: base-6 ridge 1.1448, base-6 ELM 1.1310,
|
||
believed-base-7 ELM 0.7800 with the extra `tgtLatVel` noise, exactly as the
|
||
earlier run found.
|
||
2. **But there is a large, real, observable effect — and it is not the one the
|
||
first experiment was looking for.** Feeding the ELM the shooter's *own*
|
||
predicted lead angle, `beliefPredErr` (computed from its scan history and its
|
||
own state, no ground truth at fire time), gives **RMSE 0.4220 vs the
|
||
constant's 1.1463, −63%, better on 5/5 folds and under a shifted split**.
|
||
Ridge with that one feature alone: 0.4400. The law behind it is plain:
|
||
`label ≈ 0.87 · lead`, i.e. DrussGT applies ~13% of the correct lead.
|
||
3. **Scan staleness carries nothing on its own** (scanAge ridge 1.1405,
|
||
scan-only ELM 1.1395, scan-age-bucketed 1.1458, all = the constant). The
|
||
conclusion from the first run stands and is now confirmed twice.
|
||
4. **What carries what:** believed lead angle = everything (−63%); believed
|
||
geometry without it = nothing (≈ constant); believed lateral velocity /
|
||
closing / range alone = −19%; our own gunHeat/power/round/tick/disp = zero.
|
||
5. **Caveats that decide whether a gun gets built:**
|
||
- the effect needs a *fresh* (same-tick) scan; with a strictly-prior scan it
|
||
is 1.1388 vs 1.1462, i.e. nothing. If a future DrussGT version stops
|
||
shooting on scan, the model dies;
|
||
- the 0.87 (≈13% of lead) coefficient is fitted on 2 battles against one
|
||
opponent. It is a constant, not a law. Re-measure before betting on it;
|
||
- the model predicts **DrussGT's** aim error. Whether that translates into a
|
||
better shot of *ours* is still the unproven premise of this whole bench
|
||
(see the original VERDICT) — nothing here tests it.
|
||
- `beliefPredErr` is computed from the shooter's belief about us. We can
|
||
approximate it from our own state + its known bullet speed + an assumed
|
||
scan age of 0 (right 97% of the time), but we never observe its radar. A
|
||
cleaner input exists and was not tried here: **its bullets' observed hit
|
||
positions / directions are public `BulletHit*Event`s**, which directly
|
||
measure its gun bearing and therefore its lead. That is the obvious next
|
||
experiment if a gun is actually built.
|
||
|
||
**Bottom line: do build the cheap version — it is a constant, not a network.**
|
||
The finding reduces to a single arithmetic term plus one fudge factor:
|
||
*its error ≈ 0.87 × (lead it should have applied)*. Do not ship an ELM gun; ship
|
||
`0.87 × lead(angle_to_enemy, own_lateral_velocity, its_bullet_speed, assumed
|
||
scan_age=0)` and re-measure against more battles.
|
||
|
||
## Files (realistic experiment)
|
||
|
||
| file | role |
|
||
|---|---|
|
||
| `extract_realistic.py` | same labels, observable-only features; optional 2nd arg writes the strictly-prior-scan leakage-audit dataset |
|
||
| `samples_realistic.ndjson` | 8676 samples, labels identical to `samples.ndjson` |
|
||
| `samples_realistic_prev.ndjson` | leakage audit (no same-tick scan) |
|
||
| `bench_realistic.nim` | baselines, ridge ablation, ELM sweep, learning curve, scan-age buckets |
|
||
| `analyse_realistic.py` | CV ridge on feature subsets + leakage audit + the `label ≈ 0.87·lead` law check |
|
||
| `run_realistic.log`, `analysis_realistic.log` | outputs of the two runs above |
|
||
|
||
---
|
||
|
||
# Generalization across opponents
|
||
|
||
**Question:** the `beliefPredErr` result (ELM 0.4220 vs const 1.1463, −63% against
|
||
DrussGT) was found on one opponent. Is it a real technique or a DrussGT artifact?
|
||
|
||
Run date: 2025-10-05. Nim 2.2.4. Logs: `gen_analysis.log`, `gen_bench.log`,
|
||
`gen_cross.log`. Corpora: `gen/*.ndjson` (from `data/generalization_raw/`).
|
||
|
||
```bash
|
||
cd tools/elm_bench
|
||
# 1. capture (20 rounds each, DevControlBot as the passive other tank)
|
||
mkdir -p data/generalization_raw/<Bot>/devcontrol
|
||
cd tools/raw_recorder && java -cp "shadow-classes:out:$JAR" RawRecord \
|
||
--dir ../../data/generalization_raw/<Bot>/devcontrol --rounds 20 \
|
||
--bot ../../legacy_bots/<Bot> --bot ../../DevControlBot_garage/DevControlBot
|
||
# 2. extract (same extractor, same labels; --prev = strictly-prior-scan audit)
|
||
python3 extract_realistic.py gen/<Bot>.ndjson ../../data/generalization_raw/<Bot>
|
||
python3 extract_realistic.py gen/<Bot>_prev.ndjson ../../data/generalization_raw/<Bot> --prev
|
||
# 3. analyse
|
||
python3 gen_analysis.py gen/*.ndjson # law + baselines + leakage
|
||
./bench_realistic gen/<Bot>.ndjson # per-opponent ELM sweep
|
||
./cross_opponent gen/DrussGT.ndjson gen/*.ndjson # cross-opponent matrix
|
||
```
|
||
|
||
`extract_realistic.py` now takes the corpus root as a second argument and a
|
||
`--prev` flag. Sanity: re-extracting `data/drussgt_raw` reproduces
|
||
`samples_realistic.ndjson` **byte-for-byte** (8676 rows, max |Δlabel| = 0,
|
||
max |ΔbeliefPredErr| = 0, same 8444/232 scan-age split). Nothing about the
|
||
published DrussGT result changed.
|
||
|
||
## 1. Corpora
|
||
|
||
All captured with `tools/raw_recorder/RawRecord`, 20 rounds each, legacy bot vs
|
||
**DevControlBot** (moves, never fires → every bullet is the opponent's).
|
||
`query.py --verify`: **all 8 captures CONTIGUOUS**, 0 gaps, 0 dups, every round.
|
||
|
||
| corpus | rounds | ticks | BulletFired | BulletHitBot | hit rate | samples extracted | round-groups |
|
||
|---|---|---|---|---|---|---|---|
|
||
| DrussGT (incumbent, vs DevControlBot + OscillatorBot) | 40 | 12 k | 8676 | 1200 | 13.8% | 8676 | 40 |
|
||
| Dookious | 20 | 28445 | 123 | 27 | 22.0% | **123** ⚠ | 20 |
|
||
| CassiusClay | 20 | 12353 | 704 | 190 | 27.0% | 702 | 20 |
|
||
| Diamond | 20 | 12901 | 842 | 233 | 27.7% | 822 | 20 |
|
||
| Phoenix | 20 | 15402 | 983 | 237 | 24.1% | 954 | 20 |
|
||
| GresSuffurd | 20 | 16333 | 896 | 230 | 25.7% | 895 | 20 |
|
||
| Lukious | 20 | 26779 | 1345 | 213 | 15.8% | 1344 | 20 |
|
||
| Komarious | 20 | 22663 | 1339 | 212 | 15.8% | 1302 | 20 |
|
||
| LionWWSVMvoid | 20 | 53265 | 2696 | 536 | 19.9% | 2696 | 20 |
|
||
|
||
⚠ **Dookious fired only 123 shots in 20 rounds** (it spends the match in
|
||
non-firing surf states). n = 123 ≪ 500 → every Dookious number below is
|
||
**indicative only** and is excluded from the verdict. Extraction drops a few
|
||
shots per corpus (needs exactly one live opponent), ≤ 0.5% everywhere.
|
||
|
||
## 2. Per-opponent baselines (5-fold **by round-group**, never random)
|
||
|
||
| opponent | n | const RMSE | MAE | medAE | ridge ALL-20 | ridge predErr alone |
|
||
|---|---|---|---|---|---|---|
|
||
| DrussGT | 8676 | 1.1463 | 0.7958 | 0.4284 | 0.4383 | 0.4400 |
|
||
| CassiusClay | 702 | 0.2553 | — | — | 0.1199 | 0.1195 |
|
||
| Diamond | 822 | 0.3054 | — | — | 0.0901 | 0.0876 |
|
||
| Lukious | 1344 | 0.3469 | — | — | 0.2138 | 0.2158 |
|
||
| Phoenix | 954 | 0.4158 | — | — | 0.1143 | 0.1165 |
|
||
| GresSuffurd | 895 | 0.4873 | — | — | 0.3085 | 0.3088 |
|
||
| Komarious | 1302 | 0.5886 | — | — | 0.3942 | 0.4068 |
|
||
| LionWWSVMvoid | 2696 | 0.9749 | — | — | 0.7070 | 0.7537 |
|
||
| Dookious ⚠ | 123 | 0.5012 | — | — | 0.7900 | 0.7252 |
|
||
|
||
Baselines were not weakened: distance-binned means and 5-fold round-group splits
|
||
are as in `bench_realistic.nim` for every corpus.
|
||
|
||
## 3. Per-opponent ELM results
|
||
|
||
Same sweep (H{16,32,64,128} × λ{1e-6,1e-4,1e-2,1,100} × decay{1.0,0.99,0.95},
|
||
60 configs × 5 folds, batched `refitEvery=0`, feature set ALL-21 = the realistic
|
||
feature set incl. `beliefPredErr`).
|
||
|
||
| opponent | best cfg | per-fold mean RMSE | pooled RMSE/MAE/medAE | Δ vs const | better folds |
|
||
|---|---|---|---|---|---|
|
||
| DrussGT | H=128 λ=1e-2 d=1.0 | 0.4218 | 0.4220 / 0.1824 / 0.1095 | **−63.2%** | 5/5 |
|
||
| CassiusClay | H=64 λ=1e-2 d=1.0 | 0.1221 | 0.1224 / 0.0922 / 0.0732 | **−52.1%** | 5/5 |
|
||
| Diamond | H=128 λ=1e-2 d=1.0 | 0.0891 | 0.0893 / 0.0664 / 0.0510 | **−70.8%** | 5/5 |
|
||
| Phoenix | H=128 λ=1e-2 d=1.0 | 0.1119 | 0.1120 / 0.0836 / 0.0603 | **−73.1%** | 5/5 |
|
||
| Lukious | H=64 λ=1e-2 d=1.0 | 0.2018 | 0.2037 / 0.1532 / 0.1136 | **−41.4%** | 5/5 |
|
||
| GresSuffurd | H=64 λ=1e-2 d=0.99 | 0.3032 | 0.3108 / 0.1972 / 0.1444 | **−36.3%** | 5/5 |
|
||
| Komarious | H=64 λ=1e0 d=1.0 | 0.3780 | 0.4076 / 0.2236 / 0.1241 | **−30.9%** | 5/5 |
|
||
| LionWWSVMvoid | H=64 λ=1e0 d=1.0 | 0.6277 | 0.7056 / 0.4144 / 0.2120 | **−27.8%** | 5/5 |
|
||
| Dookious ⚠ | H=128 λ=1e-4 d=1.0 | 1.1012 | 2.2941 / 1.6502 / 0.7436 | +349% | 3/5 |
|
||
|
||
Feature-ablation shape repeats per opponent: **ALL-21 ≪ believed-base-7 ≤
|
||
believed-base-6 ≈ constant** everywhere (e.g. Diamond 0.0893 / 0.1351 / 0.3027;
|
||
Phoenix 0.1120 / 0.2671 / 0.4105). `beliefPredErr` remains the whole effect —
|
||
ridge on that single feature alone already lands within 3% of the best ELM for
|
||
every corpus ≥ 700 samples. H=64–128, λ=1e-2, decay=1.0 wins nearly everywhere.
|
||
|
||
## 4. The law: how much correct lead does each opponent apply?
|
||
|
||
Ridge `label ≈ slope · beliefPredErr + intercept`, fitted on all rows
|
||
(in-sample slope; `predErr` column above is the held-out RMSE of that fit).
|
||
|
||
| opponent | corr(label, predErr) | slope | intercept | **fraction of correct lead applied = 1 − slope** | const RMSE | predErr RMSE |
|
||
|---|---|---|---|---|---|---|
|
||
| CassiusClay | 0.884 | 0.987 | −0.004 | **1.3%** (essentially perfect lead) | 0.2553 | 0.1195 |
|
||
| GresSuffurd | 0.781 | 0.983 | −0.059 | 1.7% (perfect lead) | 0.4873 | 0.3088 |
|
||
| Phoenix | 0.961 | 0.944 | +0.012 | 5.6% | 0.4158 | 0.1165 |
|
||
| Diamond | 0.958 | 0.953 | −0.002 | 4.7% | 0.3054 | 0.0876 |
|
||
| Komarious | 0.726 | 0.866 | −0.112 | 13.4% | 0.5886 | 0.4068 |
|
||
| **DrussGT (incumbent)** | 0.923 | 0.866 | +0.042 | **13.4%** | 1.1462 | 0.4400 |
|
||
| LionWWSVMvoid | 0.638 | 0.706 | −0.064 | 29.4% | 0.9749 | 0.7537 |
|
||
| Lukious | 0.785 | 1.099 | −0.017 | −9.9% (**over**-leads) | 0.3469 | 0.2158 |
|
||
| Dookious ⚠ | 0.177 | 0.206 | −0.169 | n/a — no usable correlation (n=123) | 0.5012 | 0.7252 |
|
||
|
||
DrussGT's 0.866 slope reproduces **exactly** (0.8663 in the earlier run) on the
|
||
re-extracted corpus. The interesting part is the spread: the law holds across
|
||
the roster with slopes 0.71–1.10 — i.e. **"the opponent applies only a fraction
|
||
of the lead it should" is a shared structure**, and DrussGT's 13% is simply a
|
||
point in that range, not a peculiarity.
|
||
|
||
## 5. Scan discipline and the leakage audit
|
||
|
||
| opponent | shots on the tick of the last scan | scan-age histogram (ticks) | prev-const | **prev predErr RMSE** | prev ALL-20 |
|
||
|---|---|---|---|---|---|
|
||
| CassiusClay | 100.0% | {0:702} | 0.2553 | 0.2556 | 0.2620 |
|
||
| Phoenix | 100.0% | {0:954} | 0.4158 | 0.4160 | 0.4209 |
|
||
| Diamond | 100.0% | {0:822} | 0.3054 | 0.3054 | 0.3066 |
|
||
| **DrussGT** | **97.3%** | {0:8444, 1:232} | 1.1462 | 1.1392 | 1.1388 |
|
||
| GresSuffurd | 41.6% | {0:372, 1:523} | 0.4873 | 0.4106 | 0.4139 |
|
||
| LionWWSVMvoid | 13.9% | {0:375, 1:2321} | 0.9749 | 0.8040 | 0.7621 |
|
||
| Dookious ⚠ | 16.3% | {0:20, 1:103} | 0.5012 | 0.4411 | 0.7193 |
|
||
| Komarious | 12.5% | {0:163, 1:1139} | 0.5886 | 0.4465 | 0.4398 |
|
||
| Lukious | 11.0% | {0:148, 1:1194, 4:2} | 0.3469 | 0.2419 | 0.2391 |
|
||
|
||
Strictly-prior-scan audit per opponent (`prev…` = the belief rebuilt from scans
|
||
at t < t_fire only):
|
||
|
||
- **Same-tick shooters (CassiusClay, Phoenix, Diamond, DrussGT): the effect is
|
||
exactly reproduced and does not depend on any same-tick ordering** — these are
|
||
the bots whose behaviour is fully described by "it scans us, then fires".
|
||
- **One-tick-stale shooters (Komarious, Lukious, LionWWSVMvoid): the effect
|
||
survives *partially* and improves as the staleness grows** — Komarious
|
||
0.5886→0.4465 (−24%), Lukious 0.3469→0.2419 (−30%), LionWWSVMvoid
|
||
0.9749→0.8040 (−18%), against DrussGT's 1.1463→1.1392 (nothing). So the
|
||
"leakage" reading of the DrussGT audit was **too narrow**: staleness does not
|
||
kill the effect, it just moves part of the error into the un-modelled part.
|
||
The honest statement is that the belief-lead law holds when the belief is
|
||
fresh, degrades when it is a tick old, and needs a staleness term to stay
|
||
exact.
|
||
|
||
## 6. Cross-opponent matrix (the decisive test)
|
||
|
||
`cross_opponent.nim`, ALL-21 features, H=128 λ=1e-2 decay=1.0, train on **all**
|
||
of the row corpus, test on all rows of the column corpus (its 5 round-group folds).
|
||
|
||
Held-out RMSE:
|
||
|
||
| train \ test | DrussGT | CassiusClay | Lukious | Diamond | Phoenix | GresSuffurd | Komarious | LionWWS | Dookious⚠ |
|
||
|---|---|---|---|---|---|---|---|---|---|
|
||
| DrussGT | **0.414** | 0.200 | 0.315 | 0.162 | 0.162 | 0.359 | 0.454 | 0.835 | 0.497 |
|
||
| CassiusClay | 0.609 | **0.111** | 0.234 | 0.095 | 0.196 | 0.319 | 0.422 | 0.798 | 0.587 |
|
||
| Lukious | 1.630 | 0.180 | 0.189 | 0.126 | 0.890 | 0.476 | 0.727 | 2.281 | 0.593 |
|
||
| Diamond | 0.515 | 0.123 | 0.313 | **0.081** | 0.163 | 0.317 | 0.420 | 0.756 | 0.620 |
|
||
| Phoenix | 0.472 | 0.125 | 0.225 | 0.098 | **0.102** | 0.324 | 0.443 | 0.926 | 0.601 |
|
||
| GresSuffurd | 1.598 | 0.217 | 0.292 | 0.145 | 0.329 | **0.228** | 0.480 | 1.153 | 0.487 |
|
||
| Komarious | 1.192 | 0.221 | 0.243 | 0.146 | 0.294 | 0.354 | **0.325** | 1.188 | 0.608 |
|
||
| LionWWSVMvoid | 1.142 | 0.470 | 0.461 | 0.366 | 0.431 | 0.452 | 0.468 | **0.672** | 0.665 |
|
||
| Dookious⚠ | 4.228 | 0.894 | 0.936 | 0.884 | 1.812 | 1.319 | 1.771 | 3.466 | 0.142 |
|
||
|
||
Same thing as **Δ% vs the column's own constant baseline** (negative = better
|
||
than the constant):
|
||
|
||
| train \ test | DrussGT | CassiusClay | Lukious | Diamond | Phoenix | GresSuffurd | Komarious | LionWWS | Dookious⚠ |
|
||
|---|---|---|---|---|---|---|---|---|---|
|
||
| DrussGT | −63.9% | −21.9% | −9.2% | −47.0% | −61.0% | −26.4% | −23.0% | −14.5% | −2.6% |
|
||
| CassiusClay | −46.9% | −56.7% | −32.7% | −69.1% | −52.9% | −34.6% | −28.5% | −18.3% | +14.9% |
|
||
| Lukious | **+42.2%** | −29.4% | −45.6% | −58.9% | **+113.9%** | −2.5% | **+23.4%** | **+133.5%** | +16.1% |
|
||
| Diamond | −55.1% | −52.0% | −9.9% | −73.3% | −60.8% | −35.0% | −28.8% | −22.6% | +21.4% |
|
||
| Phoenix | −58.8% | −51.1% | −35.2% | −67.8% | −75.5% | −33.6% | −24.8% | −5.2% | +17.8% |
|
||
| GresSuffurd | **+39.4%** | −15.2% | −16.1% | −52.7% | −21.0% | −53.3% | −18.5% | **+18.0%** | −4.7% |
|
||
| Komarious | +4.0% | −13.7% | −30.1% | −52.2% | −29.4% | −27.4% | −44.8% | +21.6% | +19.0% |
|
||
| LionWWSVMvoid | −0.4% | **+83.7%** | **+32.8%** | **+19.9%** | +3.6% | −7.3% | −20.7% | −31.2% | +30.2% |
|
||
| Dookious⚠ | +268.8% | +249.8% | +169.3% | +189.4% | +335.6% | +170.3% | +200.5% | +254.8% | −72.3% |
|
||
|
||
**Pooled** (train on A + B's held-out-fold-excluded rows, test on B's fold) —
|
||
the practically relevant row set, and the one a real gun would use:
|
||
|
||
| train \ test | DrussGT | CassiusClay | Lukious | Diamond | Phoenix | GresSuffurd | Komarious | LionWWS | Dookious⚠ |
|
||
|---|---|---|---|---|---|---|---|---|---|
|
||
| DrussGT | 0.421 | 0.175 | 0.239 | 0.144 | 0.153 | 0.332 | 0.423 | 0.737 | 0.495 |
|
||
| CassiusClay | 0.431 | 0.113 | 0.208 | 0.090 | 0.114 | 0.333 | 0.453 | 0.726 | 0.572 |
|
||
| Lukious | 0.432 | 0.123 | 0.194 | 0.097 | 0.123 | 0.332 | 0.456 | 0.720 | 0.555 |
|
||
| Diamond | 0.431 | 0.118 | 0.205 | 0.084 | 0.113 | 0.322 | 0.438 | 0.723 | 0.628 |
|
||
| Phoenix | 0.431 | 0.118 | 0.207 | 0.090 | 0.104 | 0.322 | 0.424 | 0.723 | 0.503 |
|
||
| GresSuffurd | 0.432 | 0.137 | 0.211 | 0.111 | 0.152 | 0.246 | 0.425 | 0.722 | 0.470 |
|
||
| Komarious | 0.433 | 0.147 | 0.211 | 0.114 | 0.183 | 0.331 | 0.344 | 0.717 | 0.599 |
|
||
| LionWWSVMvoid | 0.441 | 0.160 | 0.222 | 0.134 | 0.169 | 0.313 | 0.413 | 0.687 | 0.532 |
|
||
| Dookious⚠ | 0.431 | 0.148 | 0.209 | 0.111 | 0.138 | 0.332 | 0.500 | 0.727 | 0.149 |
|
||
|
||
Pooling is strikingly insensitive to *which* second opponent is mixed in:
|
||
every pooled column beats its own self-trained model by a wide margin except the
|
||
diagonal, and every pooled cell beats the constant baseline by 40–75%.
|
||
|
||
## 7. VERDICT
|
||
|
||
**The gain is real and broadly general; DrussGT was not a lucky pick — but the
|
||
"transfer a model trained on one opponent" version is not what works, and one
|
||
bot (Dookious) does not fit at all.**
|
||
|
||
1. **Self-trained gain holds on 7 of 8 new opponents**, every one of them better
|
||
on 5/5 folds: −28% (LionWWSVMvoid) to −73% (Phoenix), against DrussGT's −63%.
|
||
This is not a DrussGT-specific artifact. The predicted-lead feature is the
|
||
whole effect on every roster member, with the same feature-ablation shape
|
||
(ALL-21 ≪ base-7 ≤ base-6 ≈ constant).
|
||
2. **The fitted slope generalises as an interpretation.** Slopes 0.71–1.10
|
||
across the roster: the accurate gunners (CassiusClay 0.987, Diamond 0.953,
|
||
Phoenix 0.944, GresSuffurd 0.983) apply ~100% of the correct lead, the
|
||
survivors (Komarious 0.866, DrussGT 0.866) ~13%, LionWWSVMvoid 29%, and
|
||
Lukious *over*-leads (1.099). "Opponent applies k × correct lead, k ≈ 0.13
|
||
for a mid-tier bot, k ≈ 1 for a top gunner" is a description that survives
|
||
contact with eight opponents. The **absolute** error scale still varies 5×
|
||
(const 0.2553 for CassiusClay vs 0.9749 for LionWWSVMvoid), so an accurate
|
||
gunner leaves a much smaller error to exploit — that is why its *relative*
|
||
gain is as large as it is (small denominator, very clean law, corr 0.88–0.96).
|
||
3. **Single-opponent training does NOT transfer.** DrussGT-trained → decent
|
||
everywhere (−5% to −61% vs the constant, 6/8 columns better) but never
|
||
matches a self-trained model. Worse, **Lukious, GresSuffurd, LionWWSVMvoid
|
||
and Komarious transfer badly and are actively harmful** when used as the
|
||
training corpus (up to +133% vs the constant): these are the *stale-scan*
|
||
bots (11–14% same-tick firing). Training only on them teaches the network
|
||
the wrong mapping from believed lead to true error, and applying that to a
|
||
fresh-scanning opponent overshoots.
|
||
4. **Pooling is the answer, and it is robust.** Train on ≥2 corpora, mixed,
|
||
and every opponent lands at −40% to −75% vs its own constant, and the
|
||
pooled number barely depends on *which* corpora are mixed (DrussGT+Phoenix
|
||
and DrussGT+Komarious give DrussGT 0.4308 / 0.4328). A **multi-opponent
|
||
training set is required**; a per-opponent constant is not enough and a
|
||
single-opponent network is actively risky.
|
||
5. **Scan discipline is the second axis, and it is measurable per opponent.**
|
||
Same-tick shooters (CassiusClay, Phoenix, Diamond, DrussGT) give a law that
|
||
is exact and needs no staleness term; one-tick-stale shooters give a law
|
||
that holds partially (−18% to −30% even under the strictly-prior audit) and
|
||
need an explicit staleness feature — `beliefScanAge` is in the model, but at
|
||
its current scaling it cannot recover what a freshness class would. If a gun
|
||
is built, a 2-state freshness class (same-tick / stale) is the minimal thing
|
||
to add.
|
||
6. **Dookious is a genuine negative result**: n = 123 shots, corr(label,
|
||
predErr) = 0.18, self-trained ELM *worse* than the constant (1.10 vs 0.50
|
||
per-fold mean, 3/5 folds). Dookious barely fires and barely leads; its shots
|
||
are dominated by something other than lead error. Under the stated <500
|
||
sample rule this is **indicative only** — but it is the one clear warning
|
||
that "believed lead ≈ aim error" has an exception class, and re-recording
|
||
Dookious with more rounds is the first thing to do if it matters.
|
||
|
||
**What DrussGT represents:** a mid-tier 1v1 duelist that scans-then-fires in the
|
||
same tick, has a mid-sized hit rate, and applies ~1/8 of the correct lead.
|
||
CassiusClay / Diamond / Phoenix / GresSuffurd (scan-then-fire, near-perfect
|
||
lead) and Komarious (same behaviour class as DrussGT, same 0.866 slope) are in
|
||
that population. **What it does NOT represent:** bots that fire from a
|
||
one-tick-old belief (Lukious, LionWWSVMvoid, GresSuffurd partly, Komarious
|
||
partly) — the law still holds there but with a different k and a staleness
|
||
term; and near-silent specialists (Dookious), where it fails outright.
|
||
|
||
**Is it worth building?** Yes, but not as "one ELM trained on DrussGT". The
|
||
defensible shape is: *a multi-opponent model* (the pooled row above: −40…−75%
|
||
across the board, insensitive to the mixture) *over a 2-state scan-freshness
|
||
class*, with the slope kept as a fitted, re-measurable per-opponent constant for
|
||
the handful of bots you actually face in your garage. The cheap arithmetic
|
||
version the previous section recommended (`0.87 × lead`) survives this test —
|
||
but the correct multiplier is opponent-dependent (0.0–0.3), so a single hard
|
||
constant is wrong by up to ±3× on an unknown opponent. Re-measure per opponent.
|
||
The premise of the whole bench — that predicting an opponent's aim error makes
|
||
*our* shots land better — remains untested.
|
||
|
||
## Files (generalization)
|
||
|
||
| file | role |
|
||
|---|---|
|
||
| `gen/*.ndjson`, `gen/*_prev.ndjson` | 9 extracted corpora + strictly-prior-scan audits |
|
||
| `gen_analysis.py` | per-opponent const baseline, `label ≈ slope·predErr` law, leakage audit, scan-age histogram (imports `analyse_realistic.py`) |
|
||
| `gen_bench.log` | `bench_realistic` run per corpus: baselines, ridge ablation, 60-config ELM sweep, learning curve |
|
||
| `cross_opponent.nim` | cross-opponent + pooled matrices (fixed cfg H=128 λ=1e-2 d=1.0) |
|
||
| `gen_cross.log`, `gen_analysis.log` | outputs |
|
||
|
||
## Online / adaptive learning
|
||
|
||
Question: can the ELM gun *learn an opponent during the fight* well enough, and
|
||
fast enough, to be worth more than the static pooled prior that already ships?
|
||
|
||
Reproduction:
|
||
|
||
```
|
||
cd tools/elm_bench
|
||
nim c --path:../../DevControlBot_garage/DevControlBot -o:/tmp/online online.nim
|
||
/tmp/online # all experiments (or: /tmp/online a|b|c)
|
||
```
|
||
|
||
Output: `online_run.log`.
|
||
|
||
### Setup
|
||
|
||
* Same realistic 22-feature set, same fixed cfg as the rest of the bench:
|
||
`H = 128, lambda = 1e-2, seed = 42`, `decay` swept over
|
||
{1.0, 0.999, 0.99, 0.95, 0.9}.
|
||
* **Shipped priors** = ELM trained on a *mixture* of the corpora, always
|
||
**excluding the held-out opponent** (honest held-out: 8 train / 1 test).
|
||
* **Live fight simulation** = the held-out opponent's shots fed **one at a time in
|
||
capture order, never shuffled**. Each shot is scored *before* it is trained on
|
||
(`pred[i] = infer(...)`, then `train(...)`), i.e. exactly what a live bot can
|
||
predict at that tick. No retroactive credit.
|
||
* `refitEvery = 25`: refit after every 25th shot (see EXPERIMENT C for why not
|
||
every shot).
|
||
* Error curves are windowed RMSE over the last **100** shots.
|
||
* **Caps (reported for honesty):** `POOLCAP = 600` samples per corpus in the
|
||
priors and `ONLINE_A = 700` shots streamed per held-out opponent. The full
|
||
refit-per-shot run over the whole corpora is ~40 min/config, so every config
|
||
here is capped at 5 min of wall clock. Dookious has only 123 samples, so its
|
||
"700 shots" is really 123 — indicative only (consistent with the earlier
|
||
Dookious negative).
|
||
* Baselines are untouched: the constant baseline is the **running mean of the
|
||
labels seen so far** (what a live bot can legally know), not the corpus mean.
|
||
|
||
### Experiment A — within-enemy adaptation speed
|
||
|
||
`crosses@` = first shot from which the adaptive model stays below the reference
|
||
for the rest of the run (last 100-shot window vs the tail of 700 shots).
|
||
|
||
| held-out | decay | pooled-only RMSE | beats const @shot | tail RMSE (win=100) | vs const | beats pooled-only @shot |
|
||
|---|---|---|---|---|---|---|
|
||
| CassiusClay | 1.000 | 0.1493 | 1 | 0.1253 | −45.6% | 42 |
|
||
| CassiusClay | 0.999 | 0.1284 | 0 | 0.1034 | −55.1% | 29 |
|
||
| CassiusClay | 0.990 | 0.1370 | 1 | 0.0984 | −57.3% | 457 |
|
||
| CassiusClay | 0.950 | 0.1795 | 1 | 0.1712 | −25.7% | 596 |
|
||
| CassiusClay | 0.900 | 0.2813 | 594 | 0.2007 | −12.9% | 636 |
|
||
| Dookious (n=123) | 1.000 | 0.5357 | 0 | 0.5333 | −6.6% | 121 (end) |
|
||
| Dookious | 0.999 | 0.5769 | 1 | 0.5598 | −2.0% | 121 (end) |
|
||
| Dookious | 0.990 | 0.6764 | 19 | 0.5698 | −0.2% | 100 |
|
||
| Dookious | 0.950 | 0.6578 | never | 0.6509 | **+14.0%** | 25 |
|
||
| Dookious | 0.900 | 0.8070 | never | 0.6429 | **+12.6%** | 25 |
|
||
| Phoenix | 1.000 | 0.1568 | 0 | 0.1404 | −60.7% | 28 |
|
||
| Phoenix | 0.999 | 0.1684 | 0 | 0.1142 | −68.0% | 39 |
|
||
| Phoenix | 0.990 | 0.2352 | 0 | 0.1121 | −68.6% | 140 |
|
||
| Phoenix | 0.950 | 0.5810 | 29 | 0.2394 | −33.0% | 415 |
|
||
| Phoenix | 0.900 | 0.5673 | never | 0.3969 | **+11.0%** | 423 |
|
||
|
||
Readings:
|
||
|
||
* **Against the constant**, the adaptive gun wins from shot 0–1 for decay ≥ 0.99
|
||
on the two well-populated opponents (−45…−69% RMSE). That crossover number is
|
||
not about learning, though: the pooled priors already beat the constant
|
||
immediately.
|
||
* **Against the pooled-only prior** (the real question — what does online
|
||
adaptation buy over the model we would actually ship?) the answer is
|
||
**"a bit, and noisily"**: 29–42 shots for Phoenix/CassiusClay at decay
|
||
0.999–1.0, but 140–457 at 0.99, and *never* at 0.95/0.9 on the tail. There is
|
||
no clean monotone story; most of the gain is variance reduction early in the
|
||
fight, not learning.
|
||
* **Aggressive forgetting is actively harmful.** decay 0.95 and 0.9 end up
|
||
*worse than the constant* on Phoenix/Dookious (+11…+14%), because by shot 700
|
||
the model has thrown away the pooled priors and only has ~700 noisy samples of
|
||
this opponent left. The priors are worth more than the opponent's own data at
|
||
these sample counts.
|
||
|
||
### Experiment B — opponent switch / forgetting
|
||
|
||
M = 400 shots per opponent (Dookious clamped to its 123). Numbers are windowed
|
||
RMSE of each segment, then the delta vs the "only ever trained on the last
|
||
opponent" reference (that reference is a ceiling — it has seen the whole corpus).
|
||
|
||
| sequence | decay | seg1 | seg2 | seg3 | last-segment reference | delta |
|
||
|---|---|---|---|---|---|---|
|
||
| Phoenix→CassiusClay | 1.000 | 0.1638 | 0.1092 | — | 0.1151 | −5.1% |
|
||
| Phoenix→CassiusClay | 0.999 | 0.1953 | 0.0958 | — | 0.1151 | −16.7% |
|
||
| Phoenix→CassiusClay | 0.990 | 0.1348 | 0.1049 | — | 0.1151 | −8.8% |
|
||
| Phoenix→CassiusClay | 0.950 | 0.4218 | 0.1354 | — | 0.1151 | **+17.7%** |
|
||
| Phoenix→CassiusClay | 0.900 | 0.6415 | 0.1662 | — | 0.1151 | **+44.5%** |
|
||
| CassiusClay→Phoenix | 1.000 | 0.1201 | 0.1461 | — | 0.1175 | +24.3% |
|
||
| CassiusClay→Phoenix | 0.999 | 0.0955 | 0.1288 | — | 0.1175 | +9.6% |
|
||
| CassiusClay→Phoenix | 0.990 | 0.1075 | 0.1322 | — | 0.1175 | +12.5% |
|
||
| CassiusClay→Phoenix | 0.950 | 0.1354 | 0.4218 | — | 0.1175 | **+258.9%** |
|
||
| CassiusClay→Phoenix | 0.900 | 0.1662 | 0.6415 | — | 0.1175 | **+445.8%** |
|
||
| Phoenix→CassiusClay→Dookious | 1.000 | 0.1638 | 0.1092 | 0.3810 | 0.1416 | +169.0% |
|
||
| Phoenix→CassiusClay→Dookious | 0.999 | 0.1953 | 0.0958 | 0.5509 | 0.1416 | +288.9% |
|
||
| Phoenix→CassiusClay→Dookious | 0.990 | 0.1348 | 0.1049 | 0.6142 | 0.1416 | +333.7% |
|
||
| Phoenix→CassiusClay→Dookious | 0.950 | 0.4218 | 0.1354 | 0.6997 | 0.1416 | +394.0% |
|
||
| Phoenix→CassiusClay→Dookious | 0.900 | 0.6415 | 0.1662 | 0.6290 | 0.1416 | +344.1% |
|
||
|
||
**Reconvergence and dip (Phoenix → CassiusClay, detail run).** "dip" = worst
|
||
windowed-RMSE excess over the *static pooled model on the same shots*, i.e. how
|
||
much accuracy is thrown away at the switch. "reconv" = shots into B until
|
||
windowed RMSE ≤ the B-only reference.
|
||
|
||
| decay | dip | at shot | reconvergence | tail RMSE | B-only ref | static pooled |
|
||
|---|---|---|---|---|---|---|
|
||
| 1.000 | +0.0% | – | 363 | 0.1092 | 0.1151 | 0.1211 |
|
||
| 0.999 | +0.0% | – | **0** | 0.0958 | 0.1151 | 0.1568 |
|
||
| 0.990 | +0.0% | – | **1** | 0.1049 | 0.1151 | 0.1527 |
|
||
| 0.950 | +0.0% | – | never | 0.1354 | 0.1151 | 0.5151 |
|
||
| 0.900 | **+97.5%** | 138 | never | 0.1662 | 0.1151 | 0.5927 |
|
||
|
||
* **decay = 1.0 is confirmed as the "never forget" control**, and it behaves as
|
||
expected: no dip at all, but it also does not reach the opponent-specific
|
||
ceiling — it needs **363 shots** to reconverge, i.e. it basically stays the
|
||
pooled model. The control establishes that decay is doing real work.
|
||
* **decay 0.999 and 0.99 reconverge instantly (0–1 shot)** and dip by **0%**:
|
||
the model is never worse than the static pooled prior during the transition.
|
||
That is the configuration we would ship if we ship online learning.
|
||
* **decay 0.95 needs ~half a fight and never makes it; 0.9 dips 97%** mid-switch
|
||
— precisely the "lose several rounds" failure the user cannot afford.
|
||
* Direction matters: switching *into* Phoenix (CassiusClay→Phoenix) is the hard
|
||
direction (+9…+24% even at decay ≥ 0.99), because Phoenix's own data is the
|
||
scarce/worst-fitting one. Adaptation helps, but is not symmetric.
|
||
* **Degradation accumulates over a 3-way sequence**: the third opponent lands
|
||
+169% (decay 1.0) to +394% (0.95) above its reference. Dookious is the known
|
||
negative corpus, so this partly measures that; but the monotone worsening with
|
||
switch count is real, and 3-way is worse than any 2-way.
|
||
|
||
### Experiment C — timing and memory (H = 128, λ = 1e-2)
|
||
|
||
| accumulated samples | refit wall clock | sample memory |
|
||
|---|---|---|
|
||
| 100 | 5.1 ms | 0.02 MB |
|
||
| 500 | 23.6 ms | 0.10 MB |
|
||
| 1000 | 46.6 ms | 0.19 MB |
|
||
| 2000 | 92.4 ms | 0.38 MB |
|
||
| 5000 | 230.6 ms | 0.96 MB |
|
||
| 8700 | 402.0 ms | 1.67 MB |
|
||
|
||
* Refit is **linear in sample count** (≈43 µs/sample), because `refit()` rebuilds
|
||
the Gram matrix from every stored sample.
|
||
* Tank Royale runs 30 ticks/s → ~33 ms per tick. **Refit-per-shot is affordable
|
||
only up to ~700 accumulated samples**; by 1000 samples it is already 1.4 ticks
|
||
and by 5000 samples it is 7 ticks. A 30-round battle at ~20 shots/round
|
||
(600 shots) is borderline; a long battle is not.
|
||
* Affordable policy: **refit every k shots with k ≥ ceil(refit_ms / 33)** — e.g.
|
||
every 25 shots is safe up to ~2000 samples, every 50 up to ~4000. That is what
|
||
the runs above use (`refitEvery = 25`), and the crossovers are insensitive to it
|
||
because 25 shots is short relative to the 100-shot measurement window.
|
||
* **Memory grows without bound**: one sample per shot forever (24 bytes/sample
|
||
here), 1.67 MB after 8700 shots — trivial in absolute terms but never released.
|
||
A shipped bot needs a pruning rule (drop samples whose weight < ε, i.e. an
|
||
effective window) or refit cost grows without limit too.
|
||
|
||
### VERDICT
|
||
|
||
**Marginally viable, and only in one configuration: `decay = 0.99–0.999`,
|
||
`refitEvery = 25`, with the pooled priors kept in front of it.** Nothing beyond
|
||
that is supported by the data.
|
||
|
||
* Against the constant baseline, online adaptation is excellent and immediate
|
||
(−45…−69% RMSE) — but the *pooled-only* model is already at that level from
|
||
shot 0. **The marginal value of learning during the fight is small**: 29–42
|
||
shots to overtake pooled-only on the well-populated opponents, and the ordering
|
||
across decays is noisy rather than clean.
|
||
* Opponent switching is the case online learning is actually for, and here it
|
||
does work: at decay 0.999/0.99 the model reconverges to the opponent-specific
|
||
level within 0–1 shots **with a 0% dip**, beating the static pooled model on
|
||
the new opponent (−5…−17%) and degrading nothing. The user constraint "cannot
|
||
afford losing rounds" is satisfied at those decays.
|
||
* Aggressive forgetting (0.95, 0.9) is a clear **negative**: +18…+446% after a
|
||
switch, dips up to 97%, worse than the constant at 700 shots. Do not ship it.
|
||
* decay = 1.0 is safe but pointless online: 363 shots to reconverge, i.e. it is
|
||
just the pooled model.
|
||
* The binding practical constraint is **compute, not accuracy**: refit-per-shot
|
||
breaks the 33 ms tick budget at ~700 samples. Refit-every-25 is the affordable
|
||
policy, and a sample-pruning rule is needed before a long battle.
|
||
* Honest caveat: the 3-way sequence and the reverse direction both degrade
|
||
(+9…+24% at the best decay), so a multi-battle online gun does not get
|
||
monotonically better; the gain is per-battle, and reset-on-new-battle is the
|
||
safer default.
|
||
|
||
**Plain language:** teaching the gun during the fight works a little, mainly
|
||
when the opponent changes. Forgetting old data aggressively — the thing that
|
||
sounds like it should help — clearly hurts, sometimes a lot. At 0.99 forgetting,
|
||
the gun is never worse than the version that only remembers training, and picks
|
||
up a new opponent almost immediately. The catch is that refreshing the model
|
||
costs about half a millisecond per 1000 remembered shots, so it must be done
|
||
every ~25 shots, not every shot.
|
||
|
||
### Files (online)
|
||
|
||
| file | role |
|
||
|---|---|
|
||
| `online.nim` | experiments A/B/C (args `a` / `b` / `c` to run one) |
|
||
| `online_run.log` | output of the full run quoted above |
|
||
|
||
---
|
||
|
||
# ORACLE AUDIT (2025-10-05, independent re-derivation)
|
||
|
||
Audit of the `beliefPredErr` result, written from scratch by a second pass.
|
||
Reproducer: `audit_independent.py` (stdlib-only, imports no bench code) plus a
|
||
ground-truth-poisoning re-extraction. Nothing was committed.
|
||
|
||
## 1. ORACLE AUDIT — does any target-ground-truth feature reach the ELM?
|
||
|
||
**No.** Proven by construction and by experiment.
|
||
|
||
Every one of the 22 entries in `online.nim:vecOf` maps to:
|
||
|
||
| feature (vecOf index) | source | class |
|
||
|---|---|---|
|
||
| 0 `beliefDist`, 1 inv, 2 sinRel, 3 cosRel | `xs,ys` from `scans[(round,owner,target)]` (`ScannedBotEvent`) | SCAN_HISTORY |
|
||
| 4 tgtSpeed, 13 losRate, 14 tof, 15 closing, 10/11 sin/cosPred, 12 **predErr** | finite difference `ev = (P_s−P_0)/(t_s−t_0)` over scan history | SCAN_HISTORY |
|
||
| 6 scanAge, 7 ln(scanAge+1), 8 everScanned, 9 scanGap | scan history | SCAN_HISTORY |
|
||
| 16 gunHeat, 17 power, 18 ownSpeed, 19 beliefDisp | `botStates[owner]` at the fire tick / own track | SHOOTER_OWN |
|
||
| 20 round, 21 tick | bookkeeping | SHOOTER_OWN |
|
||
| 22 sin(beliefRelBearing) | **never read** (see §3) | — |
|
||
|
||
Experimental proof: `extract_realistic.py` was re-run with the target's
|
||
ground-truth state (`T`, `vel`, and the derived `d`/`tf`) **randomly poisoned
|
||
immediately after the label is computed**. All 8676 rows: **max |Δfeature| = 0.0
|
||
for all 28 feature fields**, while the label is untouched (it is computed before
|
||
the poison). Any feature transitively depending on the target's true
|
||
position/velocity at or after the fire tick would have moved. None did.
|
||
|
||
Causal-scan check: `scans[...]` is appended in tick order, once per tick, before
|
||
the bullet loop. `hist[-1]`/`hist[-2]` are therefore at ticks `<= t_fire`.
|
||
No scan from `t_fire + 1` can enter. Same-tick scans (`age = 0`, 8444/8676 for
|
||
DrussGT) are included in the default dataset and excluded by `--prev`; the engine
|
||
emits `BulletFiredEvent` *before* `ScannedBotEvent` in every tick's event array
|
||
(14059/14059 scans are after the first bullet) — the scan is the *result* of the
|
||
scan command the bot issued that tick, which a real bot has before it fires. The
|
||
`--prev` sensitivity (1.1462 → 1.1393, i.e. nothing) is therefore a real
|
||
fragility of the finding, not a leak.
|
||
|
||
One thing a reader should know: for the 97.3 % of DrussGT rows with `age = 0`,
|
||
the dead-reckoning `ex = xs + ev*age` collapses to the scanned position, so the
|
||
"belief" is literally the target's exact position at the fire tick. That is
|
||
still observable by the shooter (it scanned this tick), but it is why the effect
|
||
is all-or-nothing in scan freshness.
|
||
|
||
## 2. LABEL AUDIT
|
||
|
||
Label formula, verbatim from `extract_realistic.py`:
|
||
|
||
```python
|
||
vel = (T[0]-p0[0], T[1]-p0[1]) # true per-tick displacement
|
||
v = bu["power"] * 10.0 # true bullet speed
|
||
d = math.dist(S, T); tf = d/v
|
||
Tp = (T[0]+vel[0]*tf, T[1]+vel[1]*tf) # one fixed-point intercept iteration
|
||
d = math.dist(S, Tp); tf = d/v
|
||
ideal = math.atan2(Tp[1]-S[1], Tp[0]-S[0])
|
||
g = math.radians(bu["direction"]) # shooter's true gun bearing
|
||
label = wrap(ideal - g)
|
||
```
|
||
|
||
It is the ground-truth aim correction, it is ground truth by design (it is the
|
||
*target* of the regression, not an input), and no label-derived quantity appears
|
||
in `vecOf`. Not trivially reconstructable: `corr(label, oracleRelBearing) =
|
||
−0.027` (the shooter's gun bearing carries almost no residual information on its
|
||
own — the earlier "turret lag" reading), whereas
|
||
`corr(label, beliefPredErr) = +0.9235`. The one feature that reconstructs the
|
||
label is the one the README already nominates as the whole effect.
|
||
|
||
## 3. FEATURE-COUNT BUG — real, but provably harmless
|
||
|
||
Confirmed: `vecOf` writes 23 entries, `FD = 22`, every call site slices
|
||
`x.toOpenArray(0, FD-1)`, so index 22 is dropped.
|
||
|
||
Index 22 is `math.sin(j["beliefRelBearing"])`. Index 2 is
|
||
`j["beliefSinRelBearing"]`, and the extractor sets
|
||
`beliefSinRelBearing = math.sin(rel)`. Verified on all 8676 rows:
|
||
`beliefSinRelBearing == sin(beliefRelBearing)` to 1e-15. **The dropped feature
|
||
is a bit-for-bit duplicate of index 2, which is kept.** Impact on every number
|
||
in this README: exactly zero. Reproducibility/clarity defect only — fix by
|
||
deleting the duplicate line (or setting `FD = 23`, which is also a no-op).
|
||
|
||
## 4. INDEPENDENT REPRODUCTION — matches
|
||
|
||
`audit_independent.py`, written fresh, stdlib only, closed-form ridge, folds
|
||
rebuilt from scratch (round-robin over distinct `group` values):
|
||
|
||
| quantity | documented | independent |
|
||
|---|---|---|
|
||
| constant baseline (5-fold, pooled) | 1.1463 | **1.1464** |
|
||
| constant baseline (per-fold mean) | 1.1406 | 1.1406 (from the bench rerun) |
|
||
| ridge slope on `beliefPredErr` | 0.8663 | **0.8663** (intercept +0.0418 both) |
|
||
| corr(label, predErr) | 0.9235 | **0.9235** |
|
||
| `beliefPredErr` alone, held-out | 0.4400 | **0.4401** |
|
||
| ELM best, held-out | 0.4220 | 0.4220 (re-ran `bench_realistic gen/DrussGT.ndjson`) |
|
||
| all-20 ridge, held-out | 0.4383 | 0.4380 |
|
||
|
||
Also reproduced on the `--prev` corpus: constant 1.1464, predErr-alone
|
||
1.1393, slope collapses 0.8663 → 0.7584 with corr 0.9235 → 0.1134.
|
||
|
||
## 5. SENSITIVITY — one feature is essentially the whole thing
|
||
|
||
| model (DrussGT, held-out) | RMSE | vs constant |
|
||
|---|---|---|
|
||
| constant | 1.1464 | — |
|
||
| `beliefScanAge` alone | 1.1458 | −0.1 % |
|
||
| `beliefTof` alone | 1.1453 | −0.1 % |
|
||
| `beliefClosing` alone | 1.1370 | −0.8 % |
|
||
| `beliefTgtLatVel` alone | 0.9368 | −18.3 % |
|
||
| **`beliefPredErr` alone** | **0.4401** | **−61.6 %** |
|
||
| all 16 observable features (ridge) | 0.4380 | −61.8 % |
|
||
| ELM, ALL-21, H=128 λ=1e-2 d=1.0 | 0.4220 | −63.2 % |
|
||
|
||
**`beliefPredErr` alone captures 96 % of the total headline gain** (−61.6 % of
|
||
−63.2 %). The other fifteen features together add 1.6 points, i.e. within the
|
||
noise of the fold spread. The ELM is a smoothed version of
|
||
`label ≈ 0.8663 · beliefPredErr + 0.0418`. Honest description: **this is a
|
||
one-feature linear law with a fitted scalar; the ELM is not doing meaningful
|
||
work beyond it.**
|
||
|
||
## 6. TIME-SPLIT VALIDITY — no look-ahead
|
||
|
||
- `online.nim` Experiment A and B, the online loop is
|
||
`pred[i] = infer(...)` **then** `train(..., ys[i])` — scored strictly before
|
||
the shot is trained on. Same in the reconvergence detail loop. No violation.
|
||
- Ordering: `gen/DrussGT.ndjson` is verified non-decreasing in `tick` within
|
||
every `group` (0 out-of-order rows of 8676), because `extract_realistic.py`
|
||
appends rows tick by tick, file by file.
|
||
- Priors in Experiment A are pooled over the *other eight* corpora, never the
|
||
held-out one.
|
||
- Feature-level look-ahead: none (see §1 — the scan history is causally
|
||
appended, and the poison test shows features depend only on the shooter's own
|
||
state and its scan history).
|
||
- The one thing that is *not* fold-blind, and is a fair criticism of the
|
||
benchmark as a whole: the ELM hyper-parameters are picked by a 60-config sweep
|
||
on the same 5 folds that are then reported. The ridge law in §4/§5 does not
|
||
have this problem (one parameter, reported held-out) and it reproduces the
|
||
headline to within 1.6 points, so the selection bias is small.
|
||
|
||
## FINAL VERDICT OF THE AUDIT
|
||
|
||
**The gains are real, not a second false positive. But the ELM is not the
|
||
finding — a single linear feature is.**
|
||
|
||
1. No forbidden feature reaches the model. Proven by a ground-truth-poisoning
|
||
re-extraction: perturbing the target's true position and velocity to random
|
||
values changes every feature by exactly 0.0 and nothing else.
|
||
2. The result reproduces independently to four decimals (slope 0.8663,
|
||
constant 1.1464, predErr-alone 0.4401 vs the published 0.8663 / 1.1463 /
|
||
0.4400). The earlier −16 % *was* an oracle artifact; this one is not.
|
||
3. The dropped index-22 feature is a duplicate of index 2 — zero impact.
|
||
4. What the benchmark actually demonstrates is **"DrussGT applies ≈ 13 % of the
|
||
correct lead, and we can compute the lead it should have applied from our own
|
||
state"**. That is one arithmetic term and one fitted scalar. Ship
|
||
`0.87 × lead`; do not ship a network for it.
|
||
5. Remaining caveats, unchanged and still binding: (a) the effect evaporates
|
||
under `--prev` for DrussGT — it is a property of bots that scan and fire in
|
||
the same tick, and a one-tick-stale opponent needs an explicit staleness
|
||
term (the per-opponent table already shows −18…−30 % there, not −60 %);
|
||
(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.
|
||
|
||
|
||
---
|
||
|
||
# RING LABEL EXPERIMENT (2025-10-05)
|
||
|
||
The gate before the ring was: **is a ring label learnable?** A ring is `N`
|
||
rays fired simultaneously from a belief centre at bullet speed; the label is the
|
||
2-D offset between the belief centre and where the ring touches the enemy circle.
|
||
`tools/ring_spike/spike.py` claimed this works (100% interception at bullet
|
||
power ≤ 1.5, independent of ray count and ring radius, collapsing to ~0.2% at
|
||
power 3.0). This section answers the learnability question, and it also shows
|
||
that the spike's headline number is an artifact.
|
||
|
||
**Answer up front: no. The ring label is worse, not richer.** It is either
|
||
degenerate (same-tick: it is an algebraic restatement of one feature the model
|
||
is already given) or unpredictable (everything else). It never beats the
|
||
incumbent 1-D aim-error label on the part that matters.
|
||
|
||
## 1. What was measured
|
||
|
||
```
|
||
python3 extract_ring.py ring_drussgt.ndjson ../../data/drussgt_raw --base samples_realistic.ndjson
|
||
nim c -r --path:../../DevControlBot_garage/DevControlBot bench_ring.nim ring_drussgt.ndjson.merged
|
||
```
|
||
|
||
`extract_ring.py` emits one row per (scan tick, enemy). It imports `collect`
|
||
and `ring_contact` from `spike.py`, so the ring geometry and the belief
|
||
reconstruction have exactly one definition. With `--base` it MERGES into an
|
||
existing `samples_*.ndjson`: every base row keeps its own features untouched
|
||
and gains `ringK / ringLat / ringRad / ringMag / ringLatAng / ringRadAng`,
|
||
`label` becomes the ring label and `label1d` keeps the incumbent aim error.
|
||
`bench_ring.nim` then scores **both labels on the same rows, the same features
|
||
and the same round-group folds**, so the comparison is row-for-row, not
|
||
corpus-for-corpus. 8119 of the 8676 DrussGT shot rows get a ring label (93.6%).
|
||
|
||
Two variants, both with and without `--prev` (strictly-prior-scan semantics):
|
||
|
||
| variant | contact tick `k` |
|
||
|---|---|
|
||
| **literal** (the spike's rule) | first `k` where some ray point is within BotRadius of the enemy |
|
||
| **`--kintercept`** (this section's repair) | `k = round(believed range / bullet speed)`, i.e. the bullet flight time — fully observable |
|
||
|
||
`label = atan2(lateral, beliefDist)` in radians, where `lateral` is the
|
||
component of (enemy true position at contact − belief dead-reckoned to contact)
|
||
perpendicular to the believed line of sight. Same units and same sign as the
|
||
incumbent aim-error label, which is what makes the head-to-head fair.
|
||
|
||
## 2. Label distribution (rad)
|
||
|
||
DrussGT corpus, literal variant, same-tick:
|
||
|
||
| column | mean | sd | \|p1\| | \|p50\| | \|p90\| | max\|·\| |
|
||
|---|---|---|---|---|---|---|
|
||
| **ring label** | −0.00023 | **0.01044** | 0.0217 | 0.00008 | 0.0148 | 0.0270 |
|
||
| 1-D aim error | +0.11074 | **1.17266** | 2.9010 | 0.0067 | 1.8073 | 3.1414 |
|
||
|
||
In pixels the ring label is `ringLat` mean −0.09 px, sd **4.26 px**, hard
|
||
clipped to ±8.00 px; `ringMag` mean 5.45 px, sd 2.66 px, **max 8.00 px**.
|
||
|
||
Two things stand out. The ring label is **112× smaller in scale** than the
|
||
incumbent one, and it is **clipped**: sd 4.26 px on a label that saturates at
|
||
±8 px is a censored distribution, not a well-behaved regression target.
|
||
|
||
`--prev`: ring sd 0.01341, `ringLat` sd 5.46 px, range −29.5…+25.2 px.
|
||
`--kintercept`: ring sd 0.14282, `ringLat` sd 59.5 px (mean `k` = 42.2 ticks).
|
||
|
||
**The cause of the clipping is the headline finding of this section.**
|
||
`ringK = 1.0000` for **all 172 723** extracted scan events, and the spike's own
|
||
output says why:
|
||
|
||
```
|
||
belief-vs-truth offset px: mean=0.75 std=0.64 p50=0.56 p90=2.00 max=3.00
|
||
BELIEF 1.0 360 400 100.00% kMean 1.00 | L1 10.00 0.00 | L2 3.19 2.24 | L3 2.10 1.75
|
||
```
|
||
|
||
The belief is already accurate to **under 3 px**, i.e. well inside the 18 px
|
||
`BotRadius`. A ring anchored at that centre therefore touches the enemy on its
|
||
very first ray step, at every power the spike recommends. The "100% at power
|
||
≤ 1.5, 0.2% at power 3.0" pattern is not ray geometry at all: it is simply
|
||
whether `k·bulletSpeed` for `k = 1` (10 or 15 px) falls inside the ±18 px
|
||
belief-error ball. At power 3.0 it does not, and no later step ever does either,
|
||
because the enemy's distance from the anchor barely changes. The spike's
|
||
"independent of ray count and ring radius" is likewise an artifact: it was never
|
||
measuring contact.
|
||
|
||
So the literal ring label is the **1-tick belief extrapolation error**, clipped
|
||
to the BotRadius. It is not a richer measurement of anything.
|
||
|
||
## 3. Learnability (same rows, same features, same 5 round-group folds)
|
||
|
||
Constant baseline, ridge ablation and ELM sweep
|
||
(H{16,32,64,128} × λ{1e-6,1e-4,1e-2,1,100}, decay 1.0, 20 configs × 5 folds,
|
||
ALL-21, λ=1e-8 ridge). Ratios are against each label's own constant.
|
||
|
||
### literal ring, same-tick
|
||
|
||
| model | pooled RMSE | MAE | medAE | vs const |
|
||
|---|---|---|---|---|
|
||
| constant | 0.01044 | 0.0083 | 0.0069 | — |
|
||
| ridge ALL 21 | 0.0026 | 0.0018 | 0.0012 | −75% |
|
||
| ridge **beliefTgtLatVel alone** | **0.00294** | | | **−71.8%** |
|
||
| ridge beliefPredErr alone | 0.00803 | | | +23.1% |
|
||
| **ELM best (H=128, λ=1e-2)** | **0.00274** | 0.00190 | 0.00136 | **ratio 0.2628, −73.7%, 5/5 folds** |
|
||
|
||
That looks like a win — until you see that one feature gets 71.8 of the 73.7
|
||
points, and it gets them for a *tautological* reason. With `k = 1` and scan
|
||
age ≈ 0, `ringLatAng ≈ beliefTgtLatVel × age / beliefDist` ≈
|
||
`beliefLosRate`. The network is re-deriving arithmetic on its own inputs. The
|
||
clipped distribution explains why the RMSE ratio (0.26) is *better* than the 1-D
|
||
one (0.36): a censored, low-variance target is easier to regress, not more
|
||
informative.
|
||
|
||
### literal ring, `--prev` (the check that matters)
|
||
|
||
| model | ring | 1-D aim |
|
||
|---|---|---|
|
||
| constant | 0.0134 | 1.1638 |
|
||
| ridge ALL 21 | 0.0133 (−0.0001) | 1.1500 |
|
||
| best single feature (beliefTgtLatVel) | +1.04% | — |
|
||
| **ELM best (H=128, λ=1)** | **ratio 0.9819, −1.8%** | **ratio 0.9899, −1.0%** |
|
||
|
||
**The ring label's apparent learnability does not survive `--prev`.** The
|
||
−73.7% collapses to −1.8%, and every single-feature ridge collapses to ≤ 1%.
|
||
It depends on the same-tick assumption *more* than the 1-D label does, not
|
||
less: it is only ever a restatement of a quantity computed from a scan taken in
|
||
the current tick. The 1-D label's `beliefPredErr` signal degrades too
|
||
(−63.7% → −1.0%), but that is a documented property of the corpora, not of the
|
||
label's construction.
|
||
|
||
### `--kintercept` (the repaired label, no clipping, mean k = 42)
|
||
|
||
| model | ring | 1-D aim |
|
||
|---|---|---|
|
||
| constant | 0.1429 | 1.1661 |
|
||
| ridge ALL 21 | 0.1426 (−0.0002) | 0.4419 |
|
||
| best single feature (cosRel) | **+0.50%** | — |
|
||
| **ELM best** | **ratio 0.9956, −0.4%, 4/5 folds** | ratio 0.3632, −63.7% |
|
||
| ELM best, `--prev` | **ratio 0.9990, −0.1%, 2/5 folds** | ratio 0.9896 |
|
||
|
||
This is the honest version of the ring label: no degenerate contact, a real
|
||
42-tick extrapolation, a 60 px spread. **It is completely unpredictable.** No
|
||
feature exceeds 0.5%, the network is 0.4% better than a constant, and the best
|
||
single Pearson correlation between any of the 21 features and the label is
|
||
**0.09** (`ringK`/`beliefDist`). Under `--prev` it is 0.09 too. A 60 px
|
||
positional error at intercept time is not a function of what we believed; it is
|
||
the opponent's unmodelled acceleration, and nothing in our own state carries it.
|
||
|
||
## 4. Head-to-head (ELM pooled RMSE ÷ constant pooled RMSE)
|
||
|
||
| dataset | ring label | 1-D aim-error label |
|
||
|---|---|---|
|
||
| same-tick, literal | **0.2628** | 0.3629 |
|
||
| `--prev`, literal | 0.9819 | 0.9899 |
|
||
| same-tick, k-intercept | 0.9956 | 0.3632 |
|
||
| `--prev`, k-intercept | 0.9990 | 0.9896 |
|
||
|
||
## VERDICT
|
||
|
||
**The ring label is not richer than the 1-D aim-error label. It is strictly
|
||
worse, and the one number that made it look better is a bug in the spike.**
|
||
|
||
1. **Not richer.** The literal ring label carries *less* information than the
|
||
incumbent: it is one linear combination of two features the model already
|
||
has (`beliefTgtLatVel`, `beliefDist`), it is censored at ±8 px, and the ELM
|
||
adds 1.9 points over that single ridge (−73.7% vs −71.8%). The 1-D label is
|
||
a genuinely behavioural quantity — the opponent's *decision*, not our own
|
||
arithmetic — and it is the only one of the two whose structure is still
|
||
visible after you hand the model everything.
|
||
2. **The gain is not bigger; it is fake.** Same-tick, the ring label's ratio
|
||
(0.2628) is nominally better than the 1-D label's (0.3629). That difference
|
||
is entirely the consequence of a smaller, clipped target: the same ELM, the
|
||
same features, a label with a hundredth of the spread (sd 0.0104 vs 1.1727). It buys no
|
||
capability.
|
||
3. **It depends MORE on the same-tick assumption, not less.** −73.7% → −1.8%
|
||
under `--prev`, versus −63.7% → −1.0% for the 1-D label. The ring label is
|
||
built out of the current tick's scan; take that away and there is nothing
|
||
left.
|
||
4. **The repaired label is pure noise.** Removing the `k = 1` degeneracy
|
||
(`--kintercept`) gives a well-posed 60 px, 42-tick-ahead target that **no**
|
||
feature and **no** ELM can predict (best 0.4%, best |corr| 0.09). This is
|
||
the actual answer to "is the ring label learnable": the belief-extrapolation
|
||
error at intercept time is not learnable from the shooter's own state.
|
||
5. **What to do with it.** Do not ship a ring label. `common_libs/guns/
|
||
waveelm.nim` is the right shape for the same idea and it is not the same
|
||
thing: it fires the ring **from the shooter**, not from the belief centre,
|
||
so the ring measures an interception *radius and bearing* (a real
|
||
measurement) and the ELM learns a bias correction to it — the ring is the
|
||
instrument, not the label. That construction is unaffected by the
|
||
`k = 1` degeneracy above and should be the one benchmarked next.
|
||
|
||
### Files (ring experiment)
|
||
|
||
```
|
||
extract_ring.py ring labels per scan tick; --prev, --kintercept,
|
||
--base (merge into samples_*.ndjson)
|
||
ring_dist.py distribution + per-feature correlation report
|
||
bench_ring.nim both labels, same rows/folds: constant, ridge
|
||
ablation, single-feature ridge, ELM sweep
|
||
ring_same.log literal ring, same-tick + 1-D on the same rows
|
||
ring_prev.log literal ring, --prev + 1-D on the same rows
|
||
ring_ki.log k-intercept ring, same-tick + 1-D
|
||
ring_ki_prev.log k-intercept ring, --prev + 1-D
|
||
```
|
||
|
||
Rebuild:
|
||
|
||
```
|
||
python3 extract_ring.py ring_drussgt.ndjson ../../data/drussgt_raw --base samples_realistic.ndjson
|
||
python3 extract_ring.py ring_prev.ndjson ../../data/drussgt_raw --prev --base samples_realistic_prev.ndjson
|
||
python3 extract_ring.py ring_ki.ndjson ../../data/drussgt_raw --kintercept --base samples_realistic.ndjson
|
||
python3 extract_ring.py ring_ki_prev.ndjson ../../data/drussgt_raw --kintercept --prev --base samples_realistic_prev.ndjson
|
||
nim c -r --path:../../DevControlBot_garage/DevControlBot bench_ring.nim ring_*.ndjson.merged
|
||
```
|
||
|
||
`bench_ring.nim` imports the ELM by relative path
|
||
(`../../DevControlBot_garage/DevControlBot/modules/ELM/elm`) and reads its input
|
||
path from `paramStr(1)`; run it from `tools/elm_bench`. No project-local import
|
||
workaround is needed — the ELM module is self-contained (stdlib only), so the
|
||
project-local loader is only an issue for callers inside the bot.
|
||
|
||
`ring_*.ndjson` and the `.merged` files are generated (40 s each) and are
|
||
gitignored; the four `.log` files are committed.
|