Alfred Cazares
← Back to the shelf
Running Last touched June 22, 2026

Lottery Number Predictor

A walk-forward optimization engine over 1,700+ historical drawings, with overfitting detection that rolls the model back when it starts memorizing.

TypeScriptNode.jsVitestCanvasStatistics

The source for this one is not public. The write-up below covers what I built and why the repository is closed. Happy to walk through it in detail on a call.

A Powerball and Mega Millions prediction engine built on walk-forward optimization and multi-signal analysis.

To be clear about the premise: lottery draws are independent and this cannot beat the odds. That is exactly why it was a good exercise. With no real signal to find, every apparent improvement in accuracy is overfitting — which makes it an unusually honest place to build model-validation machinery and watch it work.

How it works

Six weighted signals score every number: frequency, recent-hot, gap/overdue, pair momentum, positional, and recency.

Walk-forward training steps through 1,700+ historical drawings, predicts each one against only the data available before it, compares to the actual result, and adjusts signal weights. No lookahead — the model never sees a drawing before it has predicted it.

Super Train runs automatically until overfitting is detected, then rolls back to the best model rather than the last one.

Bias-variance analysis tracks systematic prediction error and feeds corrections back into the model.

Overfitting detection is surfaced visually, as a line chart of training accuracy across iterations with trend analysis, so the moment the curve turns is visible rather than inferred.

Everything else

Live jackpot display, countdown timers to the next drawings, save-and-compare against actual results after a drawing, and a running total of theoretical winnings across saved predictions.

197 tests under Vitest. Storage is local JSON files — no database, because it does not need one, and a project that does not need a database should not have one.

Runs as a browser GUI on an HTML5 canvas served from a built-in HTTP server, or as a CLI.