Search Results for

    Show / Hide Table of Contents

    Class DiscreteAreEqualOp

    Provides outgoing messages for the following factors:

    • AreEqual(Int32, Int32)
    • AreEqual<TEnum>(TEnum, TEnum)
    , given random arguments to the function.

    Inheritance
    Object
    DiscreteAreEqualOp
    Inherited Members
    Object.Equals(Object)
    Object.Equals(Object, Object)
    Object.GetHashCode()
    Object.GetType()
    Object.MemberwiseClone()
    Object.ReferenceEquals(Object, Object)
    Object.ToString()
    Namespace: Microsoft.ML.Probabilistic.Factors
    Assembly: Microsoft.ML.Probabilistic.dll
    Syntax
    [FactorMethod(typeof(Factor), "AreEqual", new Type[]{typeof(int), typeof(int)})]
    [Quality(QualityBand.Mature)]
    public static class DiscreteAreEqualOp

    Methods

    AAverageConditional(Bernoulli, Discrete, Discrete)

    EP message to a.

    Declaration
    public static Discrete AAverageConditional(Bernoulli areEqual, Discrete B, Discrete result)
    Parameters
    Type Name Description
    Bernoulli areEqual

    Incoming message from areEqual. Must be a proper distribution. If uniform, the result will be uniform.

    Discrete B

    Incoming message from b.

    Discrete result

    Modified to contain the outgoing message.

    Returns
    Type Description
    Discrete

    result

    Remarks

    The outgoing message is a distribution matching the moments of a as the random arguments are varied. The formula is proj[p(a) sum_(areEqual,b) p(areEqual,b) factor(areEqual,a,b)]/p(a).

    Exceptions
    Type Condition
    ImproperMessageException

    areEqual is not a proper distribution.

    AAverageConditional(Bernoulli, Int32, Discrete)

    EP message to a.

    Declaration
    public static Discrete AAverageConditional(Bernoulli areEqual, int B, Discrete result)
    Parameters
    Type Name Description
    Bernoulli areEqual

    Incoming message from areEqual. Must be a proper distribution. If uniform, the result will be uniform.

    Int32 B

    Constant value for b.

    Discrete result

    Modified to contain the outgoing message.

    Returns
    Type Description
    Discrete

    result

    Remarks

    The outgoing message is a distribution matching the moments of a as the random arguments are varied. The formula is proj[p(a) sum_(areEqual) p(areEqual) factor(areEqual,a,b)]/p(a).

    Exceptions
    Type Condition
    ImproperMessageException

    areEqual is not a proper distribution.

    AAverageConditional(Boolean, Discrete, Discrete)

    EP message to a.

    Declaration
    public static Discrete AAverageConditional(bool areEqual, Discrete B, Discrete result)
    Parameters
    Type Name Description
    Boolean areEqual

    Constant value for areEqual.

    Discrete B

    Incoming message from b.

    Discrete result

    Modified to contain the outgoing message.

    Returns
    Type Description
    Discrete

    result

    Remarks

    The outgoing message is a distribution matching the moments of a as the random arguments are varied. The formula is proj[p(a) sum_(b) p(b) factor(areEqual,a,b)]/p(a).

    AAverageConditional(Boolean, Int32, Discrete)

    EP message to a.

    Declaration
    public static Discrete AAverageConditional(bool areEqual, int B, Discrete result)
    Parameters
    Type Name Description
    Boolean areEqual

    Constant value for areEqual.

    Int32 B

    Constant value for b.

    Discrete result

    Modified to contain the outgoing message.

    Returns
    Type Description
    Discrete

    result

    Remarks

    The outgoing message is the factor viewed as a function of a conditioned on the given values.

    AAverageLogarithm(Bernoulli, Discrete, Discrete)

    VMP message to a.

    Declaration
    public static Discrete AAverageLogarithm(Bernoulli areEqual, Discrete B, Discrete result)
    Parameters
    Type Name Description
    Bernoulli areEqual

    Incoming message from areEqual. Must be a proper distribution. If uniform, the result will be uniform.

    Discrete B

    Incoming message from b.

    Discrete result

    Modified to contain the outgoing message.

    Returns
    Type Description
    Discrete

    result

    Remarks

    The outgoing message is the exponential of the average log-factor value, where the average is over all arguments except a. Because the factor is deterministic, areEqual is integrated out before taking the logarithm. The formula is exp(sum_(b) p(b) log(sum_areEqual p(areEqual) factor(areEqual,a,b))).

    Exceptions
    Type Condition
    ImproperMessageException

    areEqual is not a proper distribution.

    AAverageLogarithm(Bernoulli, Int32, Discrete)

    VMP message to a.

    Declaration
    public static Discrete AAverageLogarithm(Bernoulli areEqual, int B, Discrete result)
    Parameters
    Type Name Description
    Bernoulli areEqual

    Incoming message from areEqual. Must be a proper distribution. If uniform, the result will be uniform.

    Int32 B

    Constant value for b.

    Discrete result

    Modified to contain the outgoing message.

    Returns
    Type Description
    Discrete

    result

    Remarks

    The outgoing message is the factor viewed as a function of a with areEqual integrated out. The formula is sum_areEqual p(areEqual) factor(areEqual,a,b).

    Exceptions
    Type Condition
    ImproperMessageException

    areEqual is not a proper distribution.

    AAverageLogarithm(Boolean, Discrete, Discrete)

    VMP message to a.

    Declaration
    [NotSupported("Variational Message Passing does not support an AreEqual factor with fixed output.")]
    public static Discrete AAverageLogarithm(bool areEqual, Discrete B, Discrete result)
    Parameters
    Type Name Description
    Boolean areEqual

    Constant value for areEqual.

    Discrete B

    Incoming message from b.

    Discrete result

    Modified to contain the outgoing message.

    Returns
    Type Description
    Discrete

    result

    Remarks

    The outgoing message is the exponential of the average log-factor value, where the average is over all arguments except a. The formula is exp(sum_(b) p(b) log(factor(areEqual,a,b))).

    AAverageLogarithm(Boolean, Int32, Discrete)

    VMP message to a.

    Declaration
    public static Discrete AAverageLogarithm(bool areEqual, int B, Discrete result)
    Parameters
    Type Name Description
    Boolean areEqual

    Constant value for areEqual.

    Int32 B

    Constant value for b.

    Discrete result

    Modified to contain the outgoing message.

    Returns
    Type Description
    Discrete

    result

    Remarks

    The outgoing message is the factor viewed as a function of a conditioned on the given values.

    AreEqualAverageConditional(Discrete, Discrete)

    EP message to areEqual.

    Declaration
    public static Bernoulli AreEqualAverageConditional(Discrete A, Discrete B)
    Parameters
    Type Name Description
    Discrete A

    Incoming message from a.

    Discrete B

    Incoming message from b.

    Returns
    Type Description
    Bernoulli

    The outgoing EP message to the areEqual argument.

    Remarks

    The outgoing message is a distribution matching the moments of areEqual as the random arguments are varied. The formula is proj[p(areEqual) sum_(a,b) p(a,b) factor(areEqual,a,b)]/p(areEqual).

    AreEqualAverageConditional(Discrete, Int32)

    EP message to areEqual.

    Declaration
    public static Bernoulli AreEqualAverageConditional(Discrete A, int B)
    Parameters
    Type Name Description
    Discrete A

    Incoming message from a.

    Int32 B

    Constant value for b.

    Returns
    Type Description
    Bernoulli

    The outgoing EP message to the areEqual argument.

    Remarks

    The outgoing message is a distribution matching the moments of areEqual as the random arguments are varied. The formula is proj[p(areEqual) sum_(a) p(a) factor(areEqual,a,b)]/p(areEqual).

    AreEqualAverageConditional(Int32, Discrete)

    EP message to areEqual.

    Declaration
    public static Bernoulli AreEqualAverageConditional(int A, Discrete B)
    Parameters
    Type Name Description
    Int32 A

    Constant value for a.

    Discrete B

    Incoming message from b.

    Returns
    Type Description
    Bernoulli

    The outgoing EP message to the areEqual argument.

    Remarks

    The outgoing message is a distribution matching the moments of areEqual as the random arguments are varied. The formula is proj[p(areEqual) sum_(b) p(b) factor(areEqual,a,b)]/p(areEqual).

    AreEqualAverageLogarithm(Discrete, Discrete)

    Evidence message for VMP.

    Declaration
    public static Bernoulli AreEqualAverageLogarithm(Discrete A, Discrete B)
    Parameters
    Type Name Description
    Discrete A
    Discrete B
    Returns
    Type Description
    Bernoulli

    Zero.

    Remarks

    The formula for the result is log(factor(areEqual,a,b)). Adding up these values across all factors and variables gives the log-evidence estimate for VMP.

    AreEqualAverageLogarithm(Discrete, Int32)

    VMP message to areEqual.

    Declaration
    public static Bernoulli AreEqualAverageLogarithm(Discrete A, int B)
    Parameters
    Type Name Description
    Discrete A

    Constant value for a.

    Int32 B

    Incoming message from b.

    Returns
    Type Description
    Bernoulli

    The outgoing VMP message to the areEqual argument.

    Remarks

    The outgoing message is a distribution matching the moments of areEqual as the random arguments are varied. The formula is proj[sum_(b) p(b) factor(areEqual,a,b)].

    AreEqualAverageLogarithm(Int32, Discrete)

    VMP message to areEqual.

    Declaration
    public static Bernoulli AreEqualAverageLogarithm(int A, Discrete B)
    Parameters
    Type Name Description
    Int32 A

    Incoming message from a.

    Discrete B

    Incoming message from b.

    Returns
    Type Description
    Bernoulli

    The outgoing VMP message to the areEqual argument.

    Remarks

    The outgoing message is a distribution matching the moments of areEqual as the random arguments are varied. The formula is proj[sum_(a,b) p(a,b) factor(areEqual,a,b)].

    AverageLogFactor()

    Evidence message for VMP.

    Declaration
    public static double AverageLogFactor()
    Returns
    Type Description
    Double

    Zero

    Remarks

    In Variational Message Passing, the evidence contribution of a deterministic factor is zero.

    AverageLogFactor(Boolean, Int32, Int32)

    Evidence message for VMP.

    Declaration
    public static double AverageLogFactor(bool areEqual, int a, int b)
    Parameters
    Type Name Description
    Boolean areEqual

    Constant value for areEqual.

    Int32 a

    Constant value for a.

    Int32 b

    Constant value for b.

    Returns
    Type Description
    Double

    Zero.

    Remarks

    The formula for the result is log(factor(areEqual,a,b)). Adding up these values across all factors and variables gives the log-evidence estimate for VMP.

    BAverageConditional(Bernoulli, Discrete, Discrete)

    EP message to b.

    Declaration
    public static Discrete BAverageConditional(Bernoulli areEqual, Discrete A, Discrete result)
    Parameters
    Type Name Description
    Bernoulli areEqual

    Incoming message from areEqual. Must be a proper distribution. If uniform, the result will be uniform.

    Discrete A

    Incoming message from a.

    Discrete result

    Modified to contain the outgoing message.

    Returns
    Type Description
    Discrete

    result

    Remarks

    The outgoing message is a distribution matching the moments of b as the random arguments are varied. The formula is proj[p(b) sum_(areEqual,a) p(areEqual,a) factor(areEqual,a,b)]/p(b).

    Exceptions
    Type Condition
    ImproperMessageException

    areEqual is not a proper distribution.

    BAverageConditional(Bernoulli, Int32, Discrete)

    EP message to b.

    Declaration
    public static Discrete BAverageConditional(Bernoulli areEqual, int A, Discrete result)
    Parameters
    Type Name Description
    Bernoulli areEqual

    Incoming message from areEqual. Must be a proper distribution. If uniform, the result will be uniform.

    Int32 A

    Constant value for a.

    Discrete result

    Modified to contain the outgoing message.

    Returns
    Type Description
    Discrete

    result

    Remarks

    The outgoing message is a distribution matching the moments of b as the random arguments are varied. The formula is proj[p(b) sum_(areEqual) p(areEqual) factor(areEqual,a,b)]/p(b).

    Exceptions
    Type Condition
    ImproperMessageException

    areEqual is not a proper distribution.

    BAverageConditional(Boolean, Discrete, Discrete)

    EP message to b.

    Declaration
    public static Discrete BAverageConditional(bool areEqual, Discrete A, Discrete result)
    Parameters
    Type Name Description
    Boolean areEqual

    Constant value for areEqual.

    Discrete A

    Incoming message from a.

    Discrete result

    Modified to contain the outgoing message.

    Returns
    Type Description
    Discrete

    result

    Remarks

    The outgoing message is a distribution matching the moments of b as the random arguments are varied. The formula is proj[p(b) sum_(a) p(a) factor(areEqual,a,b)]/p(b).

    BAverageConditional(Boolean, Int32, Discrete)

    EP message to b.

    Declaration
    public static Discrete BAverageConditional(bool areEqual, int A, Discrete result)
    Parameters
    Type Name Description
    Boolean areEqual

    Constant value for areEqual.

    Int32 A

    Constant value for a.

    Discrete result

    Modified to contain the outgoing message.

    Returns
    Type Description
    Discrete

    result

    Remarks

    The outgoing message is the factor viewed as a function of b conditioned on the given values.

    BAverageLogarithm(Bernoulli, Discrete, Discrete)

    VMP message to b.

    Declaration
    public static Discrete BAverageLogarithm(Bernoulli areEqual, Discrete A, Discrete result)
    Parameters
    Type Name Description
    Bernoulli areEqual

    Incoming message from areEqual. Must be a proper distribution. If uniform, the result will be uniform.

    Discrete A

    Incoming message from a.

    Discrete result

    Modified to contain the outgoing message.

    Returns
    Type Description
    Discrete

    result

    Remarks

    The outgoing message is the exponential of the average log-factor value, where the average is over all arguments except b. Because the factor is deterministic, areEqual is integrated out before taking the logarithm. The formula is exp(sum_(a) p(a) log(sum_areEqual p(areEqual) factor(areEqual,a,b))).

    Exceptions
    Type Condition
    ImproperMessageException

    areEqual is not a proper distribution.

    BAverageLogarithm(Bernoulli, Int32, Discrete)

    VMP message to b.

    Declaration
    public static Discrete BAverageLogarithm(Bernoulli areEqual, int A, Discrete result)
    Parameters
    Type Name Description
    Bernoulli areEqual

    Incoming message from areEqual. Must be a proper distribution. If uniform, the result will be uniform.

    Int32 A

    Constant value for a.

    Discrete result

    Modified to contain the outgoing message.

    Returns
    Type Description
    Discrete

    result

    Remarks

    The outgoing message is the factor viewed as a function of b with areEqual integrated out. The formula is sum_areEqual p(areEqual) factor(areEqual,a,b).

    Exceptions
    Type Condition
    ImproperMessageException

    areEqual is not a proper distribution.

    BAverageLogarithm(Boolean, Discrete, Discrete)

    VMP message to b.

    Declaration
    [NotSupported("Variational Message Passing does not support an AreEqual factor with fixed output.")]
    public static Discrete BAverageLogarithm(bool areEqual, Discrete A, Discrete result)
    Parameters
    Type Name Description
    Boolean areEqual

    Constant value for areEqual.

    Discrete A

    Incoming message from a.

    Discrete result

    Modified to contain the outgoing message.

    Returns
    Type Description
    Discrete

    result

    Remarks

    The outgoing message is the exponential of the average log-factor value, where the average is over all arguments except b. The formula is exp(sum_(a) p(a) log(factor(areEqual,a,b))).

    BAverageLogarithm(Boolean, Int32, Discrete)

    VMP message to b.

    Declaration
    public static Discrete BAverageLogarithm(bool areEqual, int A, Discrete result)
    Parameters
    Type Name Description
    Boolean areEqual

    Constant value for areEqual.

    Int32 A

    Constant value for a.

    Discrete result

    Modified to contain the outgoing message.

    Returns
    Type Description
    Discrete

    result

    Remarks

    The outgoing message is the factor viewed as a function of b conditioned on the given values.

    LogAverageFactor(Bernoulli, Bernoulli)

    Evidence message for EP.

    Declaration
    public static double LogAverageFactor(Bernoulli areEqual, Bernoulli to_areEqual)
    Parameters
    Type Name Description
    Bernoulli areEqual

    Incoming message from areEqual.

    Bernoulli to_areEqual

    Outgoing message to areEqual.

    Returns
    Type Description
    Double

    Logarithm of the factor's average value across the given argument distributions.

    Remarks

    The formula for the result is log(sum_(areEqual) p(areEqual) factor(areEqual,a,b)).

    LogAverageFactor(Bernoulli, Int32, Int32)

    Evidence message for EP.

    Declaration
    public static double LogAverageFactor(Bernoulli areEqual, int a, int b)
    Parameters
    Type Name Description
    Bernoulli areEqual

    Incoming message from areEqual.

    Int32 a

    Constant value for a.

    Int32 b

    Constant value for b.

    Returns
    Type Description
    Double

    Logarithm of the factor's average value across the given argument distributions.

    Remarks

    The formula for the result is log(sum_(areEqual) p(areEqual) factor(areEqual,a,b)).

    LogAverageFactor(Boolean, Discrete, Discrete)

    Evidence message for EP.

    Declaration
    public static double LogAverageFactor(bool areEqual, Discrete A, Discrete B)
    Parameters
    Type Name Description
    Boolean areEqual

    Constant value for areEqual.

    Discrete A

    Incoming message from a.

    Discrete B

    Incoming message from b.

    Returns
    Type Description
    Double

    Logarithm of the factor's average value across the given argument distributions.

    Remarks

    The formula for the result is log(sum_(a,b) p(a,b) factor(areEqual,a,b)).

    LogAverageFactor(Boolean, Discrete, Discrete, Discrete)

    Evidence message for EP.

    Declaration
    public static double LogAverageFactor(bool areEqual, Discrete A, Discrete B, Discrete to_A)
    Parameters
    Type Name Description
    Boolean areEqual

    Constant value for areEqual.

    Discrete A

    Incoming message from a.

    Discrete B

    Incoming message from b.

    Discrete to_A

    Outgoing message to A.

    Returns
    Type Description
    Double

    Logarithm of the factor's average value across the given argument distributions.

    Remarks

    The formula for the result is log(sum_(a,b) p(a,b) factor(areEqual,a,b)).

    LogAverageFactor(Boolean, Discrete, Int32)

    Evidence message for EP.

    Declaration
    public static double LogAverageFactor(bool areEqual, Discrete A, int B)
    Parameters
    Type Name Description
    Boolean areEqual

    Constant value for areEqual.

    Discrete A

    Incoming message from a.

    Int32 B

    Constant value for b.

    Returns
    Type Description
    Double

    Logarithm of the factor's average value across the given argument distributions.

    Remarks

    The formula for the result is log(sum_(a) p(a) factor(areEqual,a,b)).

    LogAverageFactor(Boolean, Discrete, Int32, Discrete)

    Evidence message for EP.

    Declaration
    public static double LogAverageFactor(bool areEqual, Discrete A, int B, Discrete to_A)
    Parameters
    Type Name Description
    Boolean areEqual

    Constant value for areEqual.

    Discrete A

    Incoming message from a.

    Int32 B

    Constant value for b.

    Discrete to_A

    Outgoing message to A.

    Returns
    Type Description
    Double

    Logarithm of the factor's average value across the given argument distributions.

    Remarks

    The formula for the result is log(sum_(a) p(a) factor(areEqual,a,b)).

    LogAverageFactor(Boolean, Int32, Discrete)

    Evidence message for EP.

    Declaration
    public static double LogAverageFactor(bool areEqual, int A, Discrete B)
    Parameters
    Type Name Description
    Boolean areEqual

    Constant value for areEqual.

    Int32 A

    Constant value for a.

    Discrete B

    Incoming message from b.

    Returns
    Type Description
    Double

    Logarithm of the factor's average value across the given argument distributions.

    Remarks

    The formula for the result is log(sum_(b) p(b) factor(areEqual,a,b)).

    LogAverageFactor(Boolean, Int32, Discrete, Discrete)

    Evidence message for EP.

    Declaration
    public static double LogAverageFactor(bool areEqual, int A, Discrete B, Discrete to_B)
    Parameters
    Type Name Description
    Boolean areEqual

    Constant value for areEqual.

    Int32 A

    Constant value for a.

    Discrete B

    Incoming message from b.

    Discrete to_B

    Outgoing message to B.

    Returns
    Type Description
    Double

    Logarithm of the factor's average value across the given argument distributions.

    Remarks

    The formula for the result is log(sum_(b) p(b) factor(areEqual,a,b)).

    LogAverageFactor(Boolean, Int32, Int32)

    Evidence message for EP.

    Declaration
    public static double LogAverageFactor(bool areEqual, int a, int b)
    Parameters
    Type Name Description
    Boolean areEqual

    Constant value for areEqual.

    Int32 a

    Constant value for a.

    Int32 b

    Constant value for b.

    Returns
    Type Description
    Double

    Logarithm of the factor's average value across the given argument distributions.

    Remarks

    The formula for the result is log(factor(areEqual,a,b)).

    LogEvidenceRatio(Bernoulli)

    Evidence message for EP.

    Declaration
    public static double LogEvidenceRatio(Bernoulli areEqual)
    Parameters
    Type Name Description
    Bernoulli areEqual

    Incoming message from areEqual.

    Returns
    Type Description
    Double

    Logarithm of the factor's contribution the EP model evidence.

    Remarks

    The formula for the result is log(sum_(areEqual) p(areEqual) factor(areEqual,a,b) / sum_areEqual p(areEqual) messageTo(areEqual)). Adding up these values across all factors and variables gives the log-evidence estimate for EP.

    LogEvidenceRatio(Boolean, Discrete, Discrete, Discrete)

    Evidence message for EP.

    Declaration
    public static double LogEvidenceRatio(bool areEqual, Discrete A, Discrete B, Discrete to_A)
    Parameters
    Type Name Description
    Boolean areEqual

    Constant value for areEqual.

    Discrete A

    Incoming message from a.

    Discrete B

    Incoming message from b.

    Discrete to_A

    Outgoing message to A.

    Returns
    Type Description
    Double

    Logarithm of the factor's contribution the EP model evidence.

    Remarks

    The formula for the result is log(sum_(a,b) p(a,b) factor(areEqual,a,b)). Adding up these values across all factors and variables gives the log-evidence estimate for EP.

    LogEvidenceRatio(Boolean, Discrete, Int32, Discrete)

    Evidence message for EP.

    Declaration
    public static double LogEvidenceRatio(bool areEqual, Discrete A, int B, Discrete to_A)
    Parameters
    Type Name Description
    Boolean areEqual

    Constant value for areEqual.

    Discrete A

    Incoming message from a.

    Int32 B

    Constant value for b.

    Discrete to_A

    Outgoing message to A.

    Returns
    Type Description
    Double

    Logarithm of the factor's contribution the EP model evidence.

    Remarks

    The formula for the result is log(sum_(a) p(a) factor(areEqual,a,b)). Adding up these values across all factors and variables gives the log-evidence estimate for EP.

    LogEvidenceRatio(Boolean, Int32, Discrete, Discrete)

    Evidence message for EP.

    Declaration
    public static double LogEvidenceRatio(bool areEqual, int A, Discrete B, Discrete to_B)
    Parameters
    Type Name Description
    Boolean areEqual

    Constant value for areEqual.

    Int32 A

    Constant value for a.

    Discrete B

    Incoming message from b.

    Discrete to_B

    Outgoing message to B.

    Returns
    Type Description
    Double

    Logarithm of the factor's contribution the EP model evidence.

    Remarks

    The formula for the result is log(sum_(b) p(b) factor(areEqual,a,b)). Adding up these values across all factors and variables gives the log-evidence estimate for EP.

    LogEvidenceRatio(Boolean, Int32, Int32)

    Evidence message for EP.

    Declaration
    public static double LogEvidenceRatio(bool areEqual, int a, int b)
    Parameters
    Type Name Description
    Boolean areEqual

    Constant value for areEqual.

    Int32 a

    Constant value for a.

    Int32 b

    Constant value for b.

    Returns
    Type Description
    Double

    Logarithm of the factor's contribution the EP model evidence.

    Remarks

    The formula for the result is log(factor(areEqual,a,b)). Adding up these values across all factors and variables gives the log-evidence estimate for EP.

    In This Article
    Back to top Copyright © .NET Foundation. All rights reserved.