Class ImmutablePairDistribution<TElement, TElementDistribution>
This class can represent distributions over pairs of two types: a factorized P(x, y) = P(x) P(y)
,
and correlated P(x, y) \propto P(x) P(y) I[x=y]
. Both elements of a pair must be of the same type.
Inheritance
Implements
Inherited Members
Namespace: Microsoft.ML.Probabilistic.Distributions.Automata
Assembly: Microsoft.ML.Probabilistic.dll
Syntax
public class ImmutablePairDistribution<TElement, TElementDistribution> : ImmutablePairDistributionBase<TElement, TElementDistribution, TElement, TElementDistribution, ImmutablePairDistribution<TElement, TElementDistribution>>, IImmutableDistribution<(Option<TElement>, Option<TElement>), ImmutablePairDistribution<TElement, TElementDistribution>>, IImmutableDistribution, ICloneable, Diffable, CanCreateUniform<ImmutablePairDistribution<TElement, TElementDistribution>>, CanCreatePointMass<(Option<TElement>, Option<TElement>), ImmutablePairDistribution<TElement, TElementDistribution>>, CanGetLogProb<(Option<TElement>, Option<TElement>)>, CanGetLogAverageOf<ImmutablePairDistribution<TElement, TElementDistribution>>, CanComputeProduct<ImmutablePairDistribution<TElement, TElementDistribution>>, CanComputeProduct<ImmutablePairDistribution<TElement, TElementDistribution>, ImmutablePairDistribution<TElement, TElementDistribution>>, SummableExactly<ImmutablePairDistribution<TElement, TElementDistribution>>, SummableExactly<ImmutablePairDistribution<TElement, TElementDistribution>, ImmutablePairDistribution<TElement, TElementDistribution>>, Summable<ImmutablePairDistribution<TElement, TElementDistribution>, ImmutablePairDistribution<TElement, TElementDistribution>>, CanCreatePartialUniform<ImmutablePairDistribution<TElement, TElementDistribution>> where TElementDistribution : IImmutableDistribution<TElement, TElementDistribution>, CanGetLogAverageOf<TElementDistribution>, CanComputeProduct<TElementDistribution>, CanCreatePartialUniform<TElementDistribution>, new()
Type Parameters
Name | Description |
---|---|
TElement | The type of a pair element. |
TElementDistribution | The type of a distribution over |
Properties
HasEqualityConstraint
Gets a value indicating whether the equality constraint is set on the distribution.
Declaration
public bool HasEqualityConstraint { get; }
Property Value
Type | Description |
---|---|
Boolean |
Methods
Constrained(TElementDistribution)
Creates a distribution P(x, y) \propto P(x) P(y) I[x=y]
, where P
is a given element distribution.
Declaration
public static ImmutablePairDistribution<TElement, TElementDistribution> Constrained(TElementDistribution elementDistribution)
Parameters
Type | Name | Description |
---|---|---|
TElementDistribution | elementDistribution | The marginal distribution over pair elements. |
Returns
Type | Description |
---|---|
ImmutablePairDistribution<TElement, TElementDistribution> | The created distribution. |
Constrained(TElementDistribution, TElementDistribution)
Creates a distribution P(x, y) \propto Q(x) R(y) I[x=y]
, where Q(x)
and R(y)
are given element distributions.
Declaration
public static ImmutablePairDistribution<TElement, TElementDistribution> Constrained(TElementDistribution firstElementDistribution, TElementDistribution secondElementDistribution)
Parameters
Type | Name | Description |
---|---|---|
TElementDistribution | firstElementDistribution | The marginal distribution of the first element of a pair. |
TElementDistribution | secondElementDistribution | The marginal distribution of the second element of a pair. |
Returns
Type | Description |
---|---|
ImmutablePairDistribution<TElement, TElementDistribution> | The created distribution. |
CreatePartialUniform()
Creates a distribution uniform over the support of the current distribution.
Declaration
public override ImmutablePairDistribution<TElement, TElementDistribution> CreatePartialUniform()
Returns
Type | Description |
---|---|
ImmutablePairDistribution<TElement, TElementDistribution> | The created distribution. |
Overrides
CreatePointMass((Option<TElement>, Option<TElement>))
Creates a point mass distribution.
Declaration
public override ImmutablePairDistribution<TElement, TElementDistribution> CreatePointMass((Option<TElement>, Option<TElement>) point)
Parameters
Type | Name | Description |
---|---|---|
(T1, T2)<Option<TElement>, Option<TElement>> | point |
Returns
Type | Description |
---|---|
ImmutablePairDistribution<TElement, TElementDistribution> | The created distribution. |
Overrides
CreateUniform()
Creates a uniform distribution
Declaration
public override ImmutablePairDistribution<TElement, TElementDistribution> CreateUniform()
Returns
Type | Description |
---|---|
ImmutablePairDistribution<TElement, TElementDistribution> | The created distribution. |
Overrides
GetLogAverageOf(ImmutablePairDistribution<TElement, TElementDistribution>)
The log-probability that two distributions would draw the same sample.
Declaration
public override double GetLogAverageOf(ImmutablePairDistribution<TElement, TElementDistribution> that)
Parameters
Type | Name | Description |
---|---|---|
ImmutablePairDistribution<TElement, TElementDistribution> | that |
Returns
Type | Description |
---|---|
Double |
|
Overrides
Remarks
This can be considered a type of inner product between distributions.
GetLogProb((Option<TElement>, Option<TElement>))
Evaluate the log of the density function at the specified domain value
Declaration
public override double GetLogProb((Option<TElement>, Option<TElement>) pair)
Parameters
Type | Name | Description |
---|---|---|
(T1, T2)<Option<TElement>, Option<TElement>> | pair |
Returns
Type | Description |
---|---|
Double | The log density |
Overrides
Remarks
Not currently implemented.
IsUniform()
Checks whether the current distribution is uniform.
Declaration
public override bool IsUniform()
Returns
Type | Description |
---|---|
Boolean | true if the current distribution is uniform, false otherwise. |
Overrides
MaxDiff(Object)
The maximum difference between this instance and the given
Declaration
public override double MaxDiff(object that)
Parameters
Type | Name | Description |
---|---|---|
Object | that |
Returns
Type | Description |
---|---|
Double |
Overrides
Remarks
Not currently implemented.
Multiply(ImmutablePairDistribution<TElement, TElementDistribution>)
Computes the product of the current instance and other
.
Declaration
public override ImmutablePairDistribution<TElement, TElementDistribution> Multiply(ImmutablePairDistribution<TElement, TElementDistribution> other)
Parameters
Type | Name | Description |
---|---|---|
ImmutablePairDistribution<TElement, TElementDistribution> | other |
Returns
Type | Description |
---|---|
ImmutablePairDistribution<TElement, TElementDistribution> | The product. |
Overrides
Remarks
Not currently implemented.
ProjectFirst(TElement, out Option<TElementDistribution>)
Computes P(y) = R(x, y)
, where R(x, y)
is the current pair distribution,
and x
is a given element.
Declaration
public override double ProjectFirst(TElement first, out Option<TElementDistribution> result)
Parameters
Type | Name | Description |
---|---|---|
TElement | first | |
Option<TElementDistribution> | result |
Returns
Type | Description |
---|---|
Double | The logarithm of the scale for the projection result. |
Overrides
ProjectFirst(TElementDistribution, out Option<TElementDistribution>)
Computes P(y) = sum_x Q(x) R(x, y)
, where R(x, y)
is the current pair distribution,
and Q(x)
is a given element distribution.
Declaration
public override double ProjectFirst(TElementDistribution first, out Option<TElementDistribution> result)
Parameters
Type | Name | Description |
---|---|---|
TElementDistribution | first | |
Option<TElementDistribution> | result |
Returns
Type | Description |
---|---|
Double | The logarithm of the scale for the projection result. |
Overrides
Sum(Double, ImmutablePairDistribution<TElement, TElementDistribution>, Double)
Computes a distribution with its parameters set to best match a mixture distribution.
Declaration
public override ImmutablePairDistribution<TElement, TElementDistribution> Sum(double weightThis, ImmutablePairDistribution<TElement, TElementDistribution> other, double weightOther)
Parameters
Type | Name | Description |
---|---|---|
Double | weightThis | A finite nonnegative weight. |
ImmutablePairDistribution<TElement, TElementDistribution> | other | |
Double | weightOther | A finite nonnegative weight. |
Returns
Type | Description |
---|---|
ImmutablePairDistribution<TElement, TElementDistribution> | A distribution of the result type that best matches a mixture distribution. |
Overrides
Remarks
Not currently implemented.
ToString()
Returns a string that represents the distribution.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
String | A string that represents the distribution. |
Overrides
Transpose()
Creates a distribution Q(y, x) = P(x, y)
, where P(x, y)
is the current distribution.
Declaration
public ImmutablePairDistribution<TElement, TElementDistribution> Transpose()
Returns
Type | Description |
---|---|
ImmutablePairDistribution<TElement, TElementDistribution> | The created distribution. |
UniformConstrained()
Creates a distribution P(x, y) \propto I[x=y]
.
Declaration
public static ImmutablePairDistribution<TElement, TElementDistribution> UniformConstrained()
Returns
Type | Description |
---|---|
ImmutablePairDistribution<TElement, TElementDistribution> | The created distribution. |