Start from a rule written by hand, then let it learn.
| Step | CSS, per point p and hidden unit k |
|---|---|
| forward | h = max(0, calc(x·a + y·b + c)), s = calc(Σ v·h + d) |
| loss | g = t · clamp(0, 57 − t·s, 1): the point's colour if it's wrong or within the margin |
| through the ReLU | f = clamp(0, h, 1), the derivative [z > 0] |
| update | v += Σ g·h / 31, a += v · Σ g·f·x / 151, b += v · Σ g·f·y / 151, c += v · Σ 2·g·f / 31, d += 4·Σ g, each clamped |
Integers throughout. Every divisor is odd, so CSS's rounding matches Python's exactly, and the clamps keep every sum under 2²⁴. The first layer's step is five times smaller than the rest: with a big step a box edge overshoots, flips, and its ReLU dies.