Click or drag to resize
Bernoulli Structure
Microsoft Research
Represents a distribution on a binary variable.

Namespace: MicrosoftResearch.Infer.Distributions
Assembly: Infer.Runtime (in Infer.Runtime.dll) Version: 2.6.41128.1 (2.6.41128.1)
Syntax
[SerializableAttribute]
[Quality(QualityBand.Mature)]
public struct Bernoulli : IDistribution<bool>, 
	ICloneable, HasPoint<bool>, Diffable, CanGetLogProb<bool>, 
	SettableTo<Bernoulli>, SettableToProduct<Bernoulli>, SettableToProduct<Bernoulli, Bernoulli>, 
	SettableToUniform, SettableToRatio<Bernoulli>, SettableToRatio<Bernoulli, Bernoulli>, 
	SettableToPower<Bernoulli>, SettableToWeightedSumExact<Bernoulli>, SettableToWeightedSum<Bernoulli>, 
	Sampleable<bool>, CanGetMean<double>, CanSetMean<double>, 
	CanGetVariance<double>, CanGetLogAverageOf<Bernoulli>, CanGetLogAverageOfPower<Bernoulli>, 
	CanGetAverageLog<Bernoulli>, CanGetLogNormalizer, CanGetMode<bool>

The Bernoulli type exposes the following members.

Constructors
  NameDescription
Public methodBernoulli(Double)
Creates a Bernoulli distribution with given probability of being true.
Public methodBernoulli(Bernoulli)
Copy constructor.
Top
Methods
  NameDescription
Public methodClone
Clones this Bernoulli.
Public methodStatic memberFromLogOdds
Instantiates a Bernoulli distribution from a log-odds value
Public methodStatic memberGate
Computes the Bernoulli gating function in the log-odds domain.
Public methodGetAverageLog
The expected logarithm of that distribution under this distribution.
Public methodGetLogAverageOf
Log of the probability that a draw from this distribution is equal to a draw from that distribution.
Public methodGetLogAverageOfPower
Get the integral of this distribution times another distribution raised to a power.
Public methodGetLogNormalizer
Gets the log normalizer of the distribution
Public methodGetLogProb
Evaluates the logarithm of the density function
Public methodGetLogProbFalse
Gets the log probability of the binary variable being false
Public methodGetLogProbTrue
Gets the log probability of the binary variable being true
Public methodGetMean
Gets the mean of this Bernoulli distribution
Public methodGetMode
The most probable value.
Public methodGetProbFalse
Gets the probability of the binary variable being false
Public methodGetProbTrue
Gets the probability of the binary variable being true
Public methodGetVariance
Gets the variance of this Bernoulli distribution
Public methodIsUniform
Whether the distribution is uniform
Public methodStatic memberLogitProbEqual
Computes the logical AreEqual function in the log-odds domain.
Public methodStatic memberLogProbEqual
Computes the log-probability that A==B where p(A)=Logistic(x), p(B)=Logistic(y).
Public methodMaxDiff
The maximum 'difference' between this instance and that instance. This returns the absolute difference between the Log-odds
Public methodStatic memberOr
Computes the logical OR function in the log-odds domain.
Public methodStatic memberPointMass
Instantiates a point-mass Bernoulli distribution
Public methodSample
Samples from a Bernoulli distribution
Public methodSample(Boolean)
Public methodStatic memberSample(Double)
Samples from a Bernoulli distribution with a specified p(true)
Public methodSetLogProbFalse
Sets the log probability of the binary variable being false
Public methodSetLogProbTrue
Sets the log probability of the binary variable being true
Public methodSetMean
Sets the mean of this Bernoulli distribution
Public methodSetProbFalse
Sets the probability of the binary variable being false
Public methodSetProbTrue
Sets the probability of the binary variable being true
Public methodSetTo
Sets this instance to have the parameters of another instance
Public methodSetToPower
Sets this instance to the power of a Bernoulli distributions
Public methodSetToProduct
Sets this instance to a product of two Bernoulli distributions
Public methodSetToRatio
Sets this instance to a ratio of two Bernoulli distributions
Public methodSetToSum
Creates a Bernoulli distribution which is a weighted sum of two Bernoulli distribution
Public methodSetToUniform
Sets the distribution to uniform
Public methodStatic memberUniform
Instantiates a uniform Bernoulli distribution
Top
Operators
  NameDescription
Public operatorStatic memberDivision
Creates a Bernoulli distribution which is the ratio of two Bernoulli distribution
Public operatorStatic memberEquality
Equals operator
Public operatorStatic memberExclusiveOr
Raises this distribution to a power.
Public operatorStatic memberInequality
Not equals operator
Public operatorStatic memberLogicalNot
Creates the complementary distribution
Public operatorStatic memberMultiply
Creates a Bernoulli distribution which is the product of two Bernoulli distribution
Top
Fields
  NameDescription
Public fieldLogOdds
Log odds parameter
Top
Properties
  NameDescription
Public propertyIsPointMass
Whether the distribution is a point mass (true with probability 1 or false with probability 1)
Public propertyPoint
Gets/sets the distribution as a point
Top
Remarks
The most common way to use the distribution is to get and set its ProbTrue property. The distribution is represented by a single number, the log odds: log p(x=true)/p(x=false). If this is 0, then the distribution is uniform. If this is infinity, then the distribution is a point mass on x=true. If this is -infinity, then the distribution is a point mass on x=false. In terms of the log odds, p(x=true) = 1/(1+exp(-logOdds)).
See Also