Search Results for

    Show / Hide Table of Contents

    Class MultinomialOp

    Provides outgoing messages for the following factors:

    • Multinomial(Int32, Vector)
    • MultinomialList(Int32, Vector)
    , given random arguments to the function.

    Inheritance
    Object
    MultinomialOp
    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(new string[]{"sample", "trialCount", "p"}, typeof(Rand), "Multinomial", new Type[]{typeof(int), typeof(Vector)})]
    [FactorMethod(typeof(Factor), "MultinomialList", new Type[]{typeof(int), typeof(Vector)})]
    [Buffers(new string[]{"MeanLog"})]
    [Quality(QualityBand.Preview)]
    public static class MultinomialOp
    Remarks

    The factor is f(sample,p,n) = n!/prod_k sample[k]! prod_k p[k]^sample[k]

    Methods

    AverageLogFactor(IList<Int32>, Int32, Dirichlet, Vector)

    Evidence message for VMP.

    Declaration
    public static double AverageLogFactor(IList<int> sample, int trialCount, Dirichlet p, Vector MeanLog)
    Parameters
    Type Name Description
    IList<Int32> sample

    Incoming message from multinomial.

    Int32 trialCount

    Constant value for trialCount.

    Dirichlet p

    Incoming message from probs.

    Vector MeanLog

    Buffer MeanLog.

    Returns
    Type Description
    Double

    Average of the factor's log-value across the given argument distributions.

    Remarks

    The formula for the result is sum_(multinomial,probs) p(multinomial,probs) log(factor(multinomial,trialCount,probs)). Adding up these values across all factors and variables gives the log-evidence estimate for VMP.

    AverageLogFactor(IList<Int32>, Int32, IList<Double>)

    Evidence message for VMP.

    Declaration
    public static double AverageLogFactor(IList<int> sample, int trialCount, IList<double> p)
    Parameters
    Type Name Description
    IList<Int32> sample

    Incoming message from multinomial.

    Int32 trialCount

    Constant value for trialCount.

    IList<Double> p

    Incoming message from probs.

    Returns
    Type Description
    Double

    Average of the factor's log-value across the given argument distributions.

    Remarks

    The formula for the result is sum_(multinomial,probs) p(multinomial,probs) log(factor(multinomial,trialCount,probs)). Adding up these values across all factors and variables gives the log-evidence estimate for VMP.

    LogAverageFactor(IList<Int32>, Int32, Dirichlet)

    Evidence message for EP.

    Declaration
    public static double LogAverageFactor(IList<int> sample, int trialCount, Dirichlet p)
    Parameters
    Type Name Description
    IList<Int32> sample

    Incoming message from multinomial.

    Int32 trialCount

    Constant value for trialCount.

    Dirichlet p

    Incoming message from probs.

    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_(multinomial,probs) p(multinomial,probs) factor(multinomial,trialCount,probs)).

    LogAverageFactor(IList<Int32>, Int32, IList<Double>)

    Evidence message for EP.

    Declaration
    public static double LogAverageFactor(IList<int> sample, int trialCount, IList<double> p)
    Parameters
    Type Name Description
    IList<Int32> sample

    Incoming message from multinomial.

    Int32 trialCount

    Constant value for trialCount.

    IList<Double> p

    Incoming message from probs.

    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_(multinomial,probs) p(multinomial,probs) factor(multinomial,trialCount,probs)).

    LogEvidenceRatio(IList<Discrete>)

    Evidence message for EP.

    Declaration
    public static double LogEvidenceRatio(IList<Discrete> sample)
    Parameters
    Type Name Description
    IList<Discrete> sample

    Incoming message from multinomial.

    Returns
    Type Description
    Double

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

    Remarks

    The formula for the result is log(sum_(multinomial) p(multinomial) factor(multinomial,trialCount,probs) / sum_multinomial p(multinomial) messageTo(multinomial)). Adding up these values across all factors and variables gives the log-evidence estimate for EP.

    LogEvidenceRatio(IList<Int32>, Int32, Dirichlet)

    Evidence message for EP.

    Declaration
    public static double LogEvidenceRatio(IList<int> sample, int trialCount, Dirichlet p)
    Parameters
    Type Name Description
    IList<Int32> sample

    Incoming message from multinomial.

    Int32 trialCount

    Constant value for trialCount.

    Dirichlet p

    Incoming message from probs.

    Returns
    Type Description
    Double

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

    Remarks

    The formula for the result is log(sum_(multinomial,probs) p(multinomial,probs) factor(multinomial,trialCount,probs) / sum_multinomial p(multinomial) messageTo(multinomial)). Adding up these values across all factors and variables gives the log-evidence estimate for EP.

    LogEvidenceRatio(IList<Int32>, Int32, IList<Double>)

    Evidence message for EP.

    Declaration
    public static double LogEvidenceRatio(IList<int> sample, int trialCount, IList<double> p)
    Parameters
    Type Name Description
    IList<Int32> sample

    Incoming message from multinomial.

    Int32 trialCount

    Constant value for trialCount.

    IList<Double> p

    Incoming message from probs.

    Returns
    Type Description
    Double

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

    Remarks

    The formula for the result is log(sum_(multinomial,probs) p(multinomial,probs) factor(multinomial,trialCount,probs) / sum_multinomial p(multinomial) messageTo(multinomial)). Adding up these values across all factors and variables gives the log-evidence estimate for EP.

    MeanLog(Dirichlet)

    Update the buffer MeanLog.

    Declaration
    public static Vector MeanLog(Dirichlet p)
    Parameters
    Type Name Description
    Dirichlet p

    Incoming message from probs.

    Returns
    Type Description
    Vector

    New value of buffer MeanLog.

    Remarks

    PAverageConditional(IList<Int32>, Int32)

    EP message to probs.

    Declaration
    public static Dirichlet PAverageConditional(IList<int> sample, int trialCount)
    Parameters
    Type Name Description
    IList<Int32> sample

    Incoming message from multinomial.

    Int32 trialCount

    Constant value for trialCount.

    Returns
    Type Description
    Dirichlet

    The outgoing EP message to the probs argument.

    Remarks

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

    PAverageLogarithm(IList<Int32>, Int32)

    VMP message to probs.

    Declaration
    public static Dirichlet PAverageLogarithm(IList<int> sample, int trialCount)
    Parameters
    Type Name Description
    IList<Int32> sample

    Incoming message from multinomial.

    Int32 trialCount

    Constant value for trialCount.

    Returns
    Type Description
    Dirichlet

    The outgoing VMP message to the probs argument.

    Remarks

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

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