Softmax (“Scores into chances”) divides each exp(score) by the total of them all. Scores now arrive one at a time and can’t be kept, so keep a small state instead: [biggest, total], the biggest score so far and total = Σ exp(score − biggest) over the scores so far, measured from that biggest one so nothing overflows. Before the first score the state is None. Write update(state, score): the new state after one more score arrives.
| 1st | 2nd | 3rd |
|---|---|---|
| 2 | −1 | 4 |
| biggest | total | |
|---|---|---|
| 1st | 2 | 1 |
| 2nd | 2 | 1.05 |
| 3rd | 4 | 1.142 |