In probability theory, statistics, and machine learning, the continuous Bernoulli distribution is a family of continuous probability distributions parameterized by a single shape parameter λ∈(0,1), defined on the unit interval x∈[0,1], by:
p(x|λ)∝λx(1−λ)1−x. The continuous Bernoulli distribution arises in deep learning and computer vision, specifically in the context of variational autoencoders, for modeling the pixel intensities of natural images. As such, it defines a proper probabilistic counterpart for the commonly used binary cross entropy loss, which is often applied to continuous, [0,1]-valued data. This practice amounts to ignoring the normalizing constant of the continuous Bernoulli distribution, since the binary cross entropy loss only defines a true log-likelihood for discrete, {0,1}-valued data. The continuous Bernoulli also defines an exponential family of distributions. Writing θ=log(λ/(1−λ)) for the natural parameter, the density can be rewritten in canonical form: p(x|θ)∝exp(θx).
Statistical inference Given an independent sample of n points x1,…,xn with xi∈[0,1]∀i from continuous Bernoulli, the log-likelihood of the natural parameter θ is
ℒ(θ)=θ∑i=1nxi−nlog{(eθ−1)/θ} and the maximum likelihood estimator of the natural parameter θ is the solution of ℒ′(θ)=0, that is, θ̂ satisfies
eθ̂eθ̂−1−1θ̂=1n∑i=1nxi where the left hand side eθ̂/(eθ̂−1)−θ̂−1 is the expected value of continuous Bernoulli with parameter θ̂. Although θ̂ does not admit a closed-form expression, it can be easily calculated with numerical inversion.
Further properties The entropy of a continuous Bernoulli distribution is
H[X]={0 if λ=12λlog(λ)−(1−λ)log(1−λ)1−2λ−log(2tanh−1(1−2λ)e(1−2λ)) otherwise
Related distributions
Bernoulli distribution The continuous Bernoulli can be thought of as a continuous relaxation of the Bernoulli distribution, which is defined on the discrete set {0,1} by the probability mass function:
p(x)=px(1−p)1−x, where p is a scalar parameter between 0 and 1. Applying this same functional form on the continuous interval [0,1] results in the continuous Bernoulli probability density function, up to a normalizing constant.
Uniform distribution The Uniform distribution between the unit interval [0,1] is a special case of continuous Bernoulli when λ=1/2 or θ=0.
Exponential distribution An exponential distribution with rate Λ restricted to the unit interval [0,1] corresponds to a continuous Bernoulli distribution with natural parameter θ=−Λ<0.
Continuous categorical distribution The multivariate generalization of the continuous Bernoulli is called the continuous-categorical.
References

