Files
zeekay ec72563345 hanzo-learn: a subsample draws what it takes, not everything it discards
An isolation forest fits each tree on 256 rows. It got them by shuffling
all n and truncating — a million swaps and eight megabytes to throw
999,744 rows away, per tree, on every core at once. That made the fit
O(n) per tree in time and memory and the cost claim in the module docs
aspirational.

Twister::choose draws `take` distinct values in `take` draws and O(take)
space. It works because the shuffle sweeps from the top: a position is
settled once and never touched again, so the last `take` entries are
fully determined after `take` draws while the first `take` are not
determined until the sweep ends — which is why this returns the tail and
truncating the head could not. Only positions a swap disturbed are
remembered.

The draws are identical to permutation(n), so a partial choice IS the
tail of the whole shuffle, reversed; that identity is the test, and it is
what makes the subsample uniform rather than merely cheap.

Also: the confusion-matrix thresholds in the parity suite are keyed as
the generator writes them, str(float), so "0.0" and not "0".
2026-08-04 17:03:23 -07:00
..