The queen of AI: assumed for noise/errors and to initialize weights (Xavier/He scale σ by the number of neurons).
A visual lab of the probability that underpins AI, split into 4 tabs:
• Distributions — plot 7 distributions and sample data from them.
• Softmax & temperature — how an LLM turns logits into probabilities and picks the next token.
• Bayes — why a test that is right 90% of the time can still fool you, with the classic medical case.
• Entropy / KL — the information theory behind cross-entropy, the loss used to train classifiers.
Everything is computed in your browser, with no server. This help changes with the tab you have open.
Pick a distribution with the buttons at the top and move its parameters with the sliders; the chart updates instantly:
• Continuous distributions (Normal, Exponential, Uniform, Beta) are drawn as a density curve (PDF) with its area under the curve.
• Discrete ones (Bernoulli, Binomial, Poisson) are drawn as bars (PMF): the probability of each integer value.
• Tick CDF to overlay the cumulative (0 to 1), the probability of getting a value ≤ x.
Each distribution comes with its parameters and a note on why it shows up in AI:
• Normal (Gaussian) μ, σ — the queen: noise/errors and weight initialization (Xavier/He scale σ by the number of neurons).
• Bernoulli p — a yes/no trial; the output of a binary classification (sigmoid) and the basis of log-loss.
• Binomial n, p — number of successes in n trials; counting hits and A/B tests.
• Poisson λ — counts of rare events per interval; mean = variance = λ.
• Exponential λ — time between events (memoryless); latencies and waits.
• Uniform a, b — maximum uncertainty over a range; uniform initialization and sampling.
• Beta α, β — a distribution over probabilities (0–1); conjugate prior of Bernoulli/Binomial in Bayesian inference.
Below the sliders four statistics are shown and recompute on their own:
• Mean — the expected value (center of mass).
• Std and Variance — how spread out the values are (the std is the square root of the variance).
• Entropy — the distribution's uncertainty, measured in nats (natural log, not bits): the flatter the distribution, the higher the entropy. A closed-form formula is used where it exists (Normal, Exponential, Uniform) and a numeric sum or integral otherwise.
Press Sample to draw N random values from the distribution (N goes from 200 to 8000 with the slider). Its histogram, normalized, is drawn over the theoretical curve: the more samples, the better the histogram matches the density — the law of large numbers in action. Clear removes the samples; changing a parameter or the distribution also discards them.
Tick CLT and each sample becomes the mean of k values (set k from 2 to 30). Whatever the source distribution —skewed, discrete or uniform—, the mean tends to a normal, ever narrower as k grows (its std is σ/√k). The limiting normal N(mean, σ/√k) is overlaid as a line. That's why the Gaussian shows up everywhere.
The queen of AI: assumed for noise/errors and to initialize weights (Xavier/He scale σ by the number of neurons).