Expand description
Logistic transforms — squash and stretch for probability <-> log-odds.
stretch(p) maps 12-bit probability [1, 4095] to log-odds (scaled integer). squash(d) maps log-odds back to 12-bit probability [1, 4095].
Both use lookup tables computed at compile time.
Formula pair: squash(d) = 2048 + d * 2047 / (K + |d|) stretch(p) = c * K / (2047 - |c|) where c = p - 2048
These are analytical inverses of each other. K=64 gives a steep sigmoid covering nearly all of [1, 4095].