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
        )
      
    
    {\displaystyle \lambda \in (0,1)}
  
, defined on the unit interval 
  
    
      
        x
        ∈
        [
        0
        ,
        1
        ]
      
    
    {\displaystyle x\in [0,1]}
  
, by:
 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
        ]
      
    
    {\displaystyle [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
        }
      
    
    {\displaystyle \{0,1\}}
  
-valued data.
 The continuous Bernoulli also defines an exponential family of distributions. Writing 
  
    
      
        η
        =
        log
        ⁡
        
          (
          
            λ
            
              /
            
            (
            1
            −
            λ
            )
          
          )
        
      
    
    {\displaystyle \eta =\log \left(\lambda /(1-\lambda )\right)}
  
 for the natural parameter, the density can be rewritten in canonical form:

  
    
      
        p
        (
        x
        
          |
        
        η
        )
        ∝
        exp
        ⁡
        (
        η
        x
        )
      
    
    {\displaystyle p(x|\eta )\propto \exp(\eta x)}
  
.
 
 The continuous Bernoulli can be thought of as a continuous relaxation of the Bernoulli distribution, which is defined on the discrete set 
  
    
      
        {
        0
        ,
        1
        }
      
    
    {\displaystyle \{0,1\}}
  
 by the probability mass function:
 where 
  
    
      
        p
      
    
    {\displaystyle p}
  
 is a scalar parameter between 0 and 1. Applying this same functional form on the continuous interval 
  
    
      
        [
        0
        ,
        1
        ]
      
    
    {\displaystyle [0,1]}
  
 results in the continuous Bernoulli probability density function, up to a normalizing constant.
 The Beta distribution has the density function:
 which can be re-written as:
 where 
  
    
      
        
          α
          
            1
          
        
        ,
        
          α
          
            2
          
        
      
    
    {\displaystyle \alpha _{1},\alpha _{2}}
  
 are positive scalar parameters, and 
  
    
      
        (
        
          x
          
            1
          
        
        ,
        
          x
          
            2
          
        
        )
      
    
    {\displaystyle (x_{1},x_{2})}
  
 represents an arbitrary point inside the 1-simplex, 
  
    
      
        
          Δ
          
            1
          
        
        =
        {
        (
        
          x
          
            1
          
        
        ,
        
          x
          
            2
          
        
        )
        :
        
          x
          
            1
          
        
        >
        0
        ,
        
          x
          
            2
          
        
        >
        0
        ,
        
          x
          
            1
          
        
        +
        
          x
          
            2
          
        
        =
        1
        }
      
    
    {\displaystyle \Delta ^{1}=\{(x_{1},x_{2}):x_{1}>0,x_{2}>0,x_{1}+x_{2}=1\}}
  
. Switching the role of the parameter and the argument in this density function, we obtain:
 This family is only identifiable up to the linear constraint 
  
    
      
        
          α
          
            1
          
        
        +
        
          α
          
            2
          
        
        =
        1
      
    
    {\displaystyle \alpha _{1}+\alpha _{2}=1}
  
, whence we obtain:
 corresponding exactly to the continuous Bernoulli density.
 An exponential distribution restricted to the unit interval is equivalent to a continuous Bernoulli distribution with appropriate[which?] parameter.
 The multivariate generalization of the continuous Bernoulli is called the continuous-categorical.