Click or drag to resize
Discrete Class
Microsoft Research
An arbitrary distribution over integers [0,D-1].
Inheritance Hierarchy
SystemObject
  MicrosoftResearch.Infer.DistributionsDiscrete

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 Discrete : IDistribution<int>, 
	ICloneable, HasPoint<int>, CanGetLogProb<int>, IXmlSerializable, 
	SettableTo<Discrete>, SettableToProduct<Discrete>, SettableToProduct<Discrete, Discrete>, 
	Diffable, SettableToUniform, SettableToPartialUniform<Discrete>, SettableToRatio<Discrete>, 
	SettableToRatio<Discrete, Discrete>, SettableToPower<Discrete>, 
	SettableToWeightedSumExact<Discrete>, SettableToWeightedSum<Discrete>, CanGetLogAverageOf<Discrete>, 
	CanGetLogAverageOfPower<Discrete>, CanGetAverageLog<Discrete>, CanGetLogNormalizer, 
	Sampleable<int>, CanGetMean<double>, CanGetVariance<double>, 
	CanGetMode<int>

The Discrete type exposes the following members.

Constructors
  NameDescription
Public methodDiscrete(Double)
Creates a Discrete distribution from the given probabilities.
Public methodDiscrete(Discrete)
Copy constructor
Public methodDiscrete(Vector)
Creates a Discrete distribution from the given probabilities.
Top
Methods
  NameDescription
Public methodClone
Clones this discrete distribution.
Public methodEvaluate
Evaluates the density at the specified domain value
Public methodGetAverageLog
The expected logarithm of that distribution under this distribution.
Public methodGetLogAverageOf
The log of the integral of the product of this discrete and that discrete
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 log density at the specified domain value
Public methodGetLogProbs
Gets the vector of log probabilities for this distribution.
Public methodGetMean
Gets the mean of the distribution
Public methodGetMedian
Gets the median of the distribution
Public methodGetMode
Gets the mode of the distribution
Public methodGetProbs
Gets the probability at each index.
Public methodGetProbs(Vector)
Gets the probability at each index.
Public methodGetVariance
Gets the variance of the distribution
Public methodGetWorkspace
Gets a Vector of size this.Dimension.
Public methodIsPartialUniform
Checks whether the distribution is uniform over its support.
Public methodIsUniform
Returns whether the discrete distribution is uniform or not
Public methodMaxDiff
Gets the maximum difference between the parameters of this discrete and that discrete
Public methodStatic memberPointMass
Creates a Discrete distribution which allows only one value.
Public methodProbEqual
The integral of the product between this discrete and that discrete. This is the probability that samples from this instance and that instance are equal
Public methodSample
Returns a sample from this discrete distribution
Public methodSample(Int32)
Returns a sample from this discrete distribution
Public methodStatic memberSample(Vector)
Returns a sample from a discrete distribution with the specified probabilities
Public methodSetProbs
Sets the probability of each index.
Public methodSetTo
Sets the parameters of this instance to the parameters of that instance
Public methodSetToPadded
Set this distribution to match the given distribution, but possibly over a larger domain
Public methodSetToPartialUniform
Sets the distribution to be uniform over its support.
Public methodSetToPartialUniformOf
Sets the distribution to be uniform over the support of a given distribution.
Public methodSetToPower
Sets the parameters to represent the power of a discrete distributions.
Public methodSetToProduct
Sets the parameters to represent the product of two discrete distributions.
Public methodSetToRatio
Public methodSetToSum
Sets the parameters to represent the weighted sum of two discrete distributions.
Public methodSetToUniform
Sets this instance to a uniform discrete (i.e. probabilities all equal)
Public methodStatic memberUniform(Int32)
Creates a uniform Discrete distribution over the values from 0 to numValues-1
Public methodStatic memberUniform(Int32, Sparsity)
Creates a uniform Discrete distribution with a specified sparsity over the values from 0 to numValues-1
Public methodStatic memberUniformInRange
Creates a Discrete distribution which is uniform over values from start to end inclusive.
Public methodStatic memberUniformInRanges(Int32, IEnumerableInt32)
Creates a Discrete distribution which is uniform over values in multiple ranges specified by pairs of start and end values. These pairs are specified as adjacent values in an enumerable whose length must therefore be even.
Public methodStatic memberUniformInRanges(Int32, Int32)
Creates a Discrete distribution which is uniform over values in multiple ranges specified by pairs of start and end values. These pairs are specified as adjacent values in an array whose length must therefore be even.
Top
Operators
  NameDescription
Public operatorStatic memberDivision
Creates a Discrete distribution which is the ratio of two Discrete distributions
Public operatorStatic memberExclusiveOr
Raises a distribution to a power.
Public operatorStatic memberMultiply
Creates a Discrete distribution which is the product of two Discrete distributions
Top
Properties
  NameDescription
Public propertyDimension
Gets the dimension of this discrete distribution
Public propertyIsPointMass
Indicates whether or not this instance is a point mass.
Public propertyItem
Gets or sets the probability at the given index.
Public propertyPoint
Sets/gets this distribution as a point distribution
Public propertySparsity
Gets the Sparsity specification of this Distribution.
Top
Explicit Interface Implementations
Remarks
The distribution is represented by a normalized Vector of length D. In the case of a point mass, the first element is infinity and the second element holds the point location. The probability of value x is available as this[x] or GetLogProb(x).
See Also