﻿Gaussian Structure
 Gaussian Structure
Microsoft Research
Represents a one-dimensional Gaussian distribution.

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

The Gaussian type exposes the following members.

Constructors
NameDescription
Gaussian(Gaussian)
Copy constructor.
Gaussian(Double, Double)
Creates a Gaussian distribution with specified mean and variance.
Top
Methods
NameDescription
Clone
Clones this Gaussian.
FromDerivatives
Construct a Gaussian distribution whose pdf has the given derivatives at a point.
FromMeanAndPrecision
Creates a Gaussian distribution with given mean and precision.
FromMeanAndVariance
Creates a Gaussian distribution with given mean and variance.
FromNatural
Creates a new Gaussian distribution from its natural parameters (Mean times precision, and Precision)
GetAverageLog
Gets the expected logarithm of that distribution under this distribution.
GetLogAverageOf
Gets the integral of the product of two Gaussians.
GetLogAverageOfPower
Get the integral of this distribution times another distribution raised to a power.
GetLogNormalizer
Gets the log of the normalizer for the Gaussian density function
GetLogProb(Double)
Evaluates the log of this one-dimensional Gaussian density.
GetLogProb(Double, Double, Double)
Evaluates the log of one-dimensional Gaussian density.
GetMean
Gets the expected value E(x)
GetMeanAndPrecision
Gets the mean and precision
GetMeanAndVariance
Gets the mean and variance
GetMode
The most probable value
GetNatural
Gets the natural parameters of the distribution (mean time precision, and precision)
GetVariance
Gets the variance
IsProper
Asks whether this Gaussian instance is proper or not. A Gaussian distribution is proper only if Precision > 0.
IsUniform
Asks whether this instance is uniform
MaxDiff
The maximum difference between the parameters of this Gaussian and that Gaussian
PointMass
Create a new point mass Gaussian distribution at a specified location
Sample
Samples from this Gaussian distribution
Sample(Double)
Samples from this Gaussian distribution. This override is only present to support the Sampleable interface
Sample(Double, Double)
Samples from a Gaussian distribution with the specified mean and precision
SetMeanAndPrecision
Sets the mean and precision
SetMeanAndVariance
Sets the mean and variance
SetNatural
Sets the natural parameters of the distribution (mean time precision, and precision)
SetTo
Sets this Gaussian instance to have the parameter values of that Gaussian instance
SetToPower
Sets the parameters to represent the power of a source Gaussian to some exponent.
SetToProduct
Sets the parameters to represent the product of two Gaussians.
SetToRatio
Sets the parameters to represent the ratio of two Gaussians, optionally forcing the precision to be non-negative.
SetToSum
Sets the mean and variance to match a Gaussian mixture.
SetToUniform
Sets this Gaussian instance to be a uniform distribution
Uniform
Creates a new uniform Gaussian distribution
WeightedSumT
Creates a distribution of the specified type which matches the mean and variance of a Gaussian mixture. The distribution type must implement CanGetMeanAndVarianceOutMeanType, VarType,
Top
Operators
NameDescription
Division
Creates a new Gaussian which is the ratio of two other Gaussians
Equality
Equals operator
ExclusiveOr
Raises a distribution to a power.
Inequality
Not equals operator
Multiply
Creates a new Gaussian which is the product of two other Gaussians
Top
Fields
NameDescription
MeanTimesPrecision
Mean times precision
Precision
Precision
Top
Properties
NameDescription
IsPointMass
Asks whether the instance is a point mass
Point
Sets/gets the instance as a point mass
Top
Remarks

The distribution is represented by two parameters: MeanTimesPrecision and Precision. Precision is the inverse of the variance, so a Gaussian with mean m and variance v is represented as Precision = 1/v, MeanTimesPrecision = m/v.

Some special cases: If the Precision is zero, then the distribution is uniform. If the Precision is infinite, then the distribution is a point mass. The Point property gives the location of the point mass.

The formula for the distribution is: N(x;m,v) = 1/sqrt(2*pi*v) * exp(-(x-m)^2/(2v)). When v=0, this reduces to delta(x-m). When v=infinity, the density is redefined to be 1. When v < 0, the density is redefined to be exp(-0.5*x^2*(1/v) + x*(m/v)), i.e. we drop the terms exp(-m^2/(2v))/sqrt(2*pi*v).