Bernoulli distribution
A Bernoulli distribution is a discrete probability distribution for one binary outcome, assigning probability p to one outcome and 1−p to the other.
Fabulous Adventures in Data Structures and Algorithms
A Bernoulli distribution is a probability distribution over two outcomes, conventionally represented by 0 and 1, with an arbitrary probability for one outcome.
- How it is used
- Models binary randomness as a reusable distribution instead of exposing direct calls to a random-number generator.
- How deep it goes
- Explains representation, degenerate cases, GCD normalization, and uniform sampling, but stops short of broader probability theory.
- Examples
- Uses fair, unfair, double-headed, double-tailed, and five-to-seven weighted coins as implementation examples.
- What you can do after
- Build it from scratch in C# with integer weights, normalized odds, singleton edge cases, and a Sample operation.
Read how Fabulous Adventures in Data Structures and Algorithms explains Bernoulli distribution →
Causal AI
The Bernoulli distribution is a discrete probability distribution over a binary outcome with a success-probability parameter.
- How it is used
- Models a binary discrete outcome within probabilistic generative modeling.
- How deep it goes
- Defines Bernoulli as a categorical special case and demonstrates parameterization and log-probability evaluation, without deriving its probability mass function.
- Examples
- Uses heads-and-tails categories, 0-and-1 indices, and Pyro's Bernoulli(probs=0.4) implementation.
- What you can do after
- Apply it via Pyro to instantiate a binary distribution and evaluate an outcome's log probability.
Related concepts
- discrete distributionkind of · A discrete probability distribution assigns probability mass to outcomes in a finite or countably infinite set of distinct values.
- probability distributionkind of · A probability distribution is a mathematical specification assigning probabilities to the possible values or outcomes of a random variable, with total probability one.
- logistic regressionused by · Logistic regression is a statistical classification model that estimates categorical outcome probabilities by applying a logistic or softmax function to a linear combination of input features.
- binomial distributionequivalent to · A binomial distribution is the probability distribution of the number of successes in a fixed number of independent trials, each with the same probability of success.
- categorical distributionkind of · A categorical distribution is a discrete probability distribution over a finite set of mutually exclusive categories or outcomes.
- dropoutused by · Dropout is a neural-network regularization technique that randomly suppresses units, connections, or activations during training to reduce overfitting.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.

