TOTO AI lab: train neural networks on the real draws

Can a neural network learn anything from 1,234 TOTO draws that anticipates the next one? This lab lets you train three models right in your browser (TensorFlow.js, nothing is uploaded). Each model estimates for every number the probability of appearing in the next draw; the 6 most probable form the line. That line is then tested on draws the model has never seen, against the exact expectation of chance.

🔮 AI & test › · 🧪 Strategy lab (backtest) ›

The three models

A · LSTM sequence model

Sees the last W draws as a sequence (each draw as a vector of 49 zeros and ones), an LSTM summarises the sequence, 49 sigmoid outputs give the probability of each number. The standard tool for time series: if there were a pattern in the order of the draws, this is where it would show up.

B · Dense network on number features

For every number, six features players actually use: frequency in the last 10, 50 and 200 draws, current gap (linear and logarithmic) and whether the number appeared in the last draw. Two hidden layers learn the probability from them. Tests whether “hot”, “cold” or “overdue” help in any combination.

C · Logistic regression

The same six features, but a single linear step: the baseline for model B. The learned weights show directly what the model bets on. If B does not beat C, the deeper network found nothing extra.

Method: the draws are split chronologically, the most recent 20% stay untouched for testing. For every test draw the model forms its line only from the draws before it. Hits per line are counted and compared with the hypergeometric distribution, i.e. with what a quick pick scores. No model sees the bonus numbers.

Train the model

Training runs entirely in your browser (TensorFlow.js, about 1.4 MB loaded once) and takes 5 to 60 seconds depending on model and device. Every run starts from random weights, so two runs never give exactly the same result.

Questions about the AI lab

Can a neural network predict the next lottery numbers?

No. The TOTO draws are independent random events with no memory: today's draw carries no information about tomorrow's. A network can therefore learn at most the base rate, every number appears equally often, and then picks as well as chance. That is exactly what the test on unseen draws shows.

Why does the loss fall during training if there is nothing to learn?

Because the network first learns the base rate: with random starting weights it estimates the probabilities completely wrong; after a few epochs they are close to K/N. That drop is learning the base rate, not the draws. After that the validation loss stagnates.

Why is the line different every time I train?

The starting weights are random and, since the data contain no signal, tiny differences in probability decide which numbers make the top K. A model with a real signal would deliver similar numbers on every run.

What does a p-value below 0.05 mean?

That a difference from chance this large arises by chance only 5% of the time, i.e. once in 20 training runs on average. Anyone varying models, windows and epochs eventually hits such a swing. It does not repeat on another period.

Which data does the model see?

Only the main numbers of the draws, chronologically up to the respective test draw. Bonus numbers, prizes and jackpots are not used. Everything runs in your browser; no data is transmitted.

Inspired by freely available lottery AI projects (LotteryAi, PowerballAi, Mega Millions AI). Their design was corrected here: predicting the next draw instead of reproducing the current one, one probability per number instead of per position, testing only on unseen draws.

▲