Example 05: Polarized adaptive cruise control

This experiment demonstrates when a polarized network is useful: the same current sensor input must produce a different action because of an earlier context.

The controller receives a driving-style pulse once at the beginning of a sequence:

  • CAUTIOUS — increase the following gap (BRAKE),
  • ASSERTIVE — reduce the following gap (ACCELERATE).

Every later radar observation is exactly the same vector [0, 0, 1]; the style is not repeated. A stateless classifier therefore cannot solve the task. The controller must retain the brief style instruction in its internal state.

Controlled comparison

The two models have the same seed, neurons, topology, weights, dataset and training:

  • acc.cognia: polarize { alpha: 0.8; eta: 0.1; mu: 0.0; }
  • acc-off.cognia: identical control with alpha: 0.0

Both use a fixed 64-neuron recurrent reservoir and train only the softmax readout. The comparison therefore measures the contribution of polarized state modulation, not a larger model or additional input feature.

Expectations

The experiment is successful if:

  1. the polarized model beats the alpha: 0 control on identical radar ticks;
  2. both BRAKE and ACCELERATE occur, ruling out majority-class accuracy;
  3. the advantage persists on sequence lengths absent from training;
  4. resetting the network between sequences removes the previous style.

Polarization is expected to improve short- to medium-term context retention, not to act as a permanent digital latch. Very long sequences will eventually converge; that is a known limit of the current continuous polarized dynamics.

Data

Training uses lengths 6, 8, 10 and 12. Evaluation uses unseen lengths 7, 9, 11 and 13. Each length is evaluated in both styles. The configuration tick (t=0) is not scored because it is not an operational driving decision. All scored ticks use the same radar input, so their label can only be inferred from history.

Dataset format is cognia-seq 3 3:

CAUTIOUS ASSERTIVE RADAR  target
1.0      0.0       0.0    HOLD        # one-time style pulse
0.0      0.0       1.0    BRAKE       # identical operational input
...

The deterministic generator produces both checked-in datasets:

php acc-gen.php --split=train --output=acc-train.seq
php acc-gen.php --split=test  --output=acc-test.seq

Training and evaluation

.\cmake-build-debug\cognia_train.exe acc.cognia acc-train.seq 800 AdaptiveCruiseControl --sequential --softmax --save acc.bin
.\cmake-build-debug\cognia_train.exe acc-off.cognia acc-train.seq 800 AdaptiveCruiseControl --sequential --softmax --save acc-off.bin

.\cmake-build-debug\cognia_serve.exe acc.cognia acc.bin --network AdaptiveCruiseControl --port 8096
php acc-eval.php --url=http://127.0.0.1:8096

Repeat the last two commands with acc-off.cognia, acc-off.bin and another port. The evaluator uses raw top-layer argmax; this avoids treating a correct but low-confidence classification as missing merely because LiteralOutput applies a display threshold.

Measured result

Hardware: NVIDIA GPU on the project development machine. Training: 800 epochs, softmax + cross-entropy readout, deterministic sequence shuffle.

Configuration Correct Operational accuracy
Polarization ON 64 / 72 88.9%
Polarization OFF 48 / 72 66.7%
Improvement +16 +22.2 pp

Operational confusion matrices:

ON                         predicted
expected          BRAKE  HOLD  ACCELERATE
BRAKE                36     0           0
ACCELERATE            8     0          28

OFF                        predicted
expected          BRAKE  HOLD  ACCELERATE
BRAKE                12     0          24
ACCELERATE            0     0          36

The OFF control tends to forget CAUTIOUS and fall back to ACCELERATE. The polarized state preserves the earlier instruction substantially longer. It is not perfect: eight late ASSERTIVE ticks are classified as BRAKE, consistent with the expected convergence limit of a continuous state.

What this does and does not prove

The result demonstrates that polarization adds usable transient context under a controlled ablation. It does not show that polarization is universally better than recurrence. An earlier range-trend version of this experiment was rejected: the ordinary leaky reservoir already differentiated increasing and decreasing distance perfectly, while polarization reduced accuracy. Numerical differentiation is therefore not the right use case; context-dependent policy selection is.

ZIP archive

Polarized-adaptive-cruise-control

Polarized-adaptive-cruise-control.zip
Download ZIP