Click or drag to resize
Dirichlet Class
Microsoft Research
A Dirichlet distribution on probability vectors.
Inheritance Hierarchy
SystemObject
  MicrosoftResearch.Infer.DistributionsDirichlet

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 class Dirichlet : IDistribution<Vector>, 
	ICloneable, HasPoint<Vector>, CanGetLogProb<Vector>, 
	SettableTo<Dirichlet>, SettableToProduct<Dirichlet>, SettableToProduct<Dirichlet, Dirichlet>, 
	Diffable, SettableToUniform, SettableToRatio<Dirichlet>, SettableToRatio<Dirichlet, Dirichlet>, 
	SettableToPower<Dirichlet>, SettableToWeightedSum<Dirichlet>, CanGetLogAverageOf<Dirichlet>, 
	CanGetLogAverageOfPower<Dirichlet>, CanGetAverageLog<Dirichlet>, CanGetLogNormalizer, 
	Sampleable<Vector>, CanGetMean<Vector>, CanGetVariance<Vector>, 
	CanGetMeanAndVariance<Vector, Vector>, CanSetMeanAndVariance<Vector, Vector>, 
	CanGetMode<Vector>

The Dirichlet type exposes the following members.

Constructors
  NameDescription
Public methodDirichlet(Double)
Creates a Dirichlet distribution with the psecified pseudo-counts
Public methodDirichlet(Dirichlet)
Copy constructor.
Public methodDirichlet(Vector)
Creates a Dirichlet distribution with the specified pseudo-counts. The pseudo-count vector can have any Sparsity specification. A specification of ApproximateWithTolerance(Double) is recommended for sparse problems, and the message functions used in inference will maintain that sparsity specification.
Top
Methods
  NameDescription
Public methodClone
Clones this Dirichlet.
Public methodStatic memberDirichletLn
Computes the log Dirichlet function: sum_i GammaLn(pseudoCount[i]) - GammaLn(sum_i pseudoCount[i])
Public methodStatic memberEstimateNewton
Modifies PseudoCount to produce the given expected logarithms.
Public methodStatic memberFromMeanLog
Create a Dirichlet distribution with the given expected logarithms.
Public methodGetAverageLog
The expected logarithm of that distribution under this distribution.
Public methodGetLogAverageOf
The log of the integral of the product of this Dirichlet and that Dirichlet
Public methodGetLogAverageOfPower
Get the integral of this distribution times another distribution raised to a power.
Public methodGetLogNormalizer
Gets the log normalizer for the distribution
Public methodGetLogProb
Evaluates the log of the Dirichlet density function at the given Vector value
Public methodGetMean
Gets the expected value E(x)
Public methodGetMean(Vector)
Gets the expected value E(x). Provide a vector to put the result
Public methodGetMeanAndVariance
Gets the mean E(p) = m/s and variance var(p) = m*(1-m)/(1+s)
Public methodGetMeanCube
Computes E[p(x)^3] for each x.
Public methodGetMeanLog
Gets the expected log value E(log(x))
Public methodGetMeanLog(Vector)
Gets the expected log value E(log(x)). Provide a vector to put the result
Public methodGetMeanLogAt
E[log prob[sample]]
Public methodGetMeanSquare
Computes E[p(x)^2] for each x.
Public methodGetMode
The most probable vector.
Public methodGetMode(Vector)
The most probable vector.
Public methodGetVariance
Gets the variance var(p) = m*(1-m)/(1+s)
Public methodIsProper
Whether the the distribution is proprer or not. It is proper if all pseudo-counts are > 0.
Public methodIsUniform
Whether this instance is uniform (i.e. has unit pseudo-counts)
Public methodMaxDiff
The maximum difference between the parameters of this Dirichlet and that Dirichlet
Public methodStatic memberPointMass(Double)
Creates a point-mass Dirichlet at the specified location
Public methodStatic memberPointMass(Vector)
Creates a point-mass Dirichlet at the specified location
Public methodSample
Samples from this Dirichlet distribution
Public methodSample(Vector)
Samples from this Dirichlet distribution. Provide a Vector to place the result
Public methodStatic memberSample(Vector, Vector)
Sample from a Dirichlet with specified pseudo-counts
Public methodStatic memberSampleFromPseudoCounts
Sample from a Dirichlet with specified pseudo-counts
Public methodSetMeanAndMeanSquare
Sets the mean, and sets the precision to best match the given mean-squares.
Public methodSetMeanAndVariance
Sets the mean, and sets the precision to best match the given variances.
Public methodSetMeanLog
Set the Dirichlet parameters to produce the given expected logarithms.
Public methodSetTo
Sets this Dirichlet instance to have the parameter values of another Dirichlet instance
Public methodSetToPower
Sets the parameters to represent the raising a Dirichlet to some power.
Public methodSetToProduct
Sets the parameters to represent the product of two Dirichlets.
Public methodSetToRatio
Sets the parameters to represent the ratio of two Dirichlets.
Public methodSetToSum
Set the parameters to match the moments of a mixture distribution.
Public methodSetToUniform
Sets the distribution to be uniform
Public methodStatic memberSymmetric(Int32, Double)
Creates a Dirichlet distribution with all pseudo-counts equal to initialCount.
Public methodStatic memberSymmetric(Int32, Double, Sparsity)
Creates a Dirichlet distribution of a given sparsity with all pseudo-counts equal to initialCount.
Public methodStatic memberUniform(Int32)
Instantiates a uniform Dirichlet distribution
Public methodStatic memberUniform(Int32, Sparsity)
Instantiates a uniform Dirichlet distribution of a given sparsity
Public methodStatic memberWeightedSumT
Static weighted sum method for distribution types for which both mean and variance can be got/set as Vectors
Top
Operators
  NameDescription
Public operatorStatic memberDivision
Creates a Dirichlet distribution which is the ratio of two Dirichlet distributions
Public operatorStatic memberExclusiveOr
Raises a distribution to a power.
Public operatorStatic memberMultiply
Creates a Dirichlet distribution which is the product of two Dirichlet distributions
Top
Fields
  NameDescription
Public fieldStatic memberAllowImproperSum
If true, SetToSum(Double, Dirichlet, Double, Dirichlet) will use moment matching as described by Minka and Lafferty (2002).
Public fieldPseudoCount
Vector of pseudo-counts
Public fieldTotalCount
Gets the total count. If infinite, the distribution is a point mass. Otherwise, this is the sum of pseudo-counts
Top
Properties
  NameDescription
Public propertyDimension
Gets the dimension of this Dirichlet
Public propertyIsPointMass
Whether this Dirichlet is a point mass
Public propertyPoint
Sets/gets this distribution as a point mass
Public propertySparsity
Gets the Sparsity specification of this Distribution.
Top
Remarks

The Dirichlet is a distribution on probability vectors. The formula for the distribution is p(x) = (Gamma(a)/prod_i Gamma(b_i)) prod_i x_i^{b_i-1} subject to the constraints x_i >= 0 and sum_i x_i = 1. The parameter a is the "total pseudo-count" and is shorthand for sum_i b_i. The vector b contains the pseudo-counts for each case i. The vector b can be sparse or dense; in many cases it is useful to give it a Sparsity specification of ApproximateWithTolerance(Double).

The distribution is represented by the pair (TotalCount, PseudoCount). If TotalCount is infinity, the distribution is a point mass. The Point property gives the mean. Otherwise TotalCount is always equal to PseudoCount.Sum(). If distribution is uniform when all PseudoCounts = 1. If any PseudoCount <= 0, the distribution is improper. In this case, the density is redefined to not include the Gamma terms, i.e. there is no normalizer.

See Also