Search Results for

    Show / Hide Table of Contents

    Struct WrappedGaussian

    A Gaussian distribution on a periodic domain, such as angles between 0 and 2*pi.

    Implements
    IDistribution<Double>
    IDistribution
    ICloneable
    Diffable
    SettableToUniform
    HasPoint<Double>
    CanGetLogProb<Double>
    SettableTo<WrappedGaussian>
    SettableToProduct<WrappedGaussian>
    SettableToProduct<WrappedGaussian, WrappedGaussian>
    SettableToRatio<WrappedGaussian>
    SettableToRatio<WrappedGaussian, WrappedGaussian>
    SettableToWeightedSum<WrappedGaussian>
    SettableToPower<WrappedGaussian>
    Sampleable<Double>
    CanGetLogAverageOf<WrappedGaussian>
    CanGetLogAverageOfPower<WrappedGaussian>
    CanGetAverageLog<WrappedGaussian>
    Inherited Members
    Object.Equals(Object, Object)
    Object.GetType()
    Object.ReferenceEquals(Object, Object)
    Namespace: Microsoft.ML.Probabilistic.Distributions
    Assembly: Microsoft.ML.Probabilistic.dll
    Syntax
    [Serializable]
    [DataContract]
    [Quality(QualityBand.Experimental)]
    public struct WrappedGaussian : IDistribution<double>, IDistribution, ICloneable, Diffable, SettableToUniform, HasPoint<double>, CanGetLogProb<double>, SettableTo<WrappedGaussian>, SettableToProduct<WrappedGaussian>, SettableToProduct<WrappedGaussian, WrappedGaussian>, SettableToRatio<WrappedGaussian>, SettableToRatio<WrappedGaussian, WrappedGaussian>, SettableToWeightedSum<WrappedGaussian>, SettableToPower<WrappedGaussian>, Sampleable<double>, CanGetLogAverageOf<WrappedGaussian>, CanGetLogAverageOfPower<WrappedGaussian>, CanGetAverageLog<WrappedGaussian>
    Remarks

    The distribution is represented by a unwrapped Gaussian and a period length L. To get the wrapped density, the unwrapped density is summed over all shifts by L, i.e. p(x) = sum_k N(x + Lk; m, v) over all integers k The wrapped density is automatically normalized over the range [0,L) because it simply moves the probability mass that was previously distributed over the real line to all lie in the interval [0,L).

    Constructors

    WrappedGaussian(Gaussian, Double)

    Create a WrappedGaussian distribution

    Declaration
    [Construction(new string[]{"Gaussian", "Period"})]
    public WrappedGaussian(Gaussian unwrapped, double period)
    Parameters
    Type Name Description
    Gaussian unwrapped
    Double period

    WrappedGaussian(Double, Double, Double)

    Create a WrappedGaussian distribution

    Declaration
    public WrappedGaussian(double unwrappedMean, double unwrappedVariance, double period = 6.2831853071795862)
    Parameters
    Type Name Description
    Double unwrappedMean
    Double unwrappedVariance
    Double period

    Fields

    Gaussian

    The unwrapped Gaussian, with mean in [0,L)

    Declaration
    [DataMember]
    public Gaussian Gaussian
    Field Value
    Type Description
    Gaussian

    Period

    The period length, greater than zero

    Declaration
    [DataMember]
    public double Period
    Field Value
    Type Description
    Double

    Properties

    IsPointMass

    True if the distribution is a point mass.

    Declaration
    [IgnoreDataMember]
    public readonly bool IsPointMass { get; }
    Property Value
    Type Description
    Boolean

    Point

    Set this distribution to a point mass, or get its location

    Declaration
    [IgnoreDataMember]
    public double Point { get; set; }
    Property Value
    Type Description
    Double

    Methods

    Clone()

    Make a deep copy of this distribution.

    Declaration
    public object Clone()
    Returns
    Type Description
    Object

    Equals(Object)

    True if this distribution has the same parameters as that

    Declaration
    public override bool Equals(object that)
    Parameters
    Type Name Description
    Object that
    Returns
    Type Description
    Boolean
    Overrides
    ValueType.Equals(Object)

    GetAverageLog(WrappedGaussian)

    Get the average logarithm of that distribution under this distribution, i.e. int this(x) log( that(x) ) dx

    Declaration
    public double GetAverageLog(WrappedGaussian that)
    Parameters
    Type Name Description
    WrappedGaussian that
    Returns
    Type Description
    Double
    Remarks

    The result is approximate.

    GetHashCode()

    A hash of the distribution parameter values

    Declaration
    public override int GetHashCode()
    Returns
    Type Description
    Int32
    Overrides
    ValueType.GetHashCode()

    GetLogAverageOf(WrappedGaussian)

    Get the logarithm of the average value of that distribution under this distribution, i.e. log(int this(x) that(x) dx)

    Declaration
    public double GetLogAverageOf(WrappedGaussian that)
    Parameters
    Type Name Description
    WrappedGaussian that
    Returns
    Type Description
    Double

    GetLogAverageOfPower(WrappedGaussian, Double)

    Get the integral of this distribution times another distribution raised to a power.

    Declaration
    public double GetLogAverageOfPower(WrappedGaussian that, double power)
    Parameters
    Type Name Description
    WrappedGaussian that
    Double power
    Returns
    Type Description
    Double

    GetLogProb(Double)

    Get the log probability density at value.

    Declaration
    public double GetLogProb(double value)
    Parameters
    Type Name Description
    Double value
    Returns
    Type Description
    Double

    IsUniform()

    True if the distribution is uniform

    Declaration
    public bool IsUniform()
    Returns
    Type Description
    Boolean

    MaxDiff(Object)

    The maximum difference between the parameters of this distribution and that

    Declaration
    public double MaxDiff(object thatd)
    Parameters
    Type Name Description
    Object thatd
    Returns
    Type Description
    Double

    Mod(Double)

    Return x modulo the period

    Declaration
    public double Mod(double x)
    Parameters
    Type Name Description
    Double x
    Returns
    Type Description
    Double

    Mod(Double, Double)

    Return x modulo the period

    Declaration
    public static double Mod(double x, double period)
    Parameters
    Type Name Description
    Double x
    Double period
    Returns
    Type Description
    Double

    Normalize()

    Declaration
    public void Normalize()

    PointMass(Double, Double)

    Create a WrappedGaussian distribution with all mass on a single point

    Declaration
    [Construction(new string[]{"Point", "Period"}, UseWhen = "IsPointMass")]
    public static WrappedGaussian PointMass(double point, double period = 6.2831853071795862)
    Parameters
    Type Name Description
    Double point
    Double period
    Returns
    Type Description
    WrappedGaussian

    Sample()

    Sample from the distribution

    Declaration
    public double Sample()
    Returns
    Type Description
    Double

    The sample value

    Sample(Double)

    Sample from the distribution

    Declaration
    public double Sample(double result)
    Parameters
    Type Name Description
    Double result

    Ignored

    Returns
    Type Description
    Double

    The sample value

    SetTo(WrappedGaussian)

    Set this distribution equal to value

    Declaration
    public void SetTo(WrappedGaussian value)
    Parameters
    Type Name Description
    WrappedGaussian value

    SetToPower(WrappedGaussian, Double)

    Set this equal to (dist)^exponent

    Declaration
    public void SetToPower(WrappedGaussian dist, double exponent)
    Parameters
    Type Name Description
    WrappedGaussian dist
    Double exponent

    SetToProduct(WrappedGaussian, WrappedGaussian)

    Set this distribution equal to the approximate product of a and b

    Declaration
    public void SetToProduct(WrappedGaussian a, WrappedGaussian b)
    Parameters
    Type Name Description
    WrappedGaussian a
    WrappedGaussian b
    Remarks

    Since WrappedGaussians are not closed under multiplication, the result is approximate.

    SetToRatio(WrappedGaussian, WrappedGaussian, Boolean)

    Set this equal to numerator/denominator

    Declaration
    public void SetToRatio(WrappedGaussian numerator, WrappedGaussian denominator, bool forceProper = false)
    Parameters
    Type Name Description
    WrappedGaussian numerator
    WrappedGaussian denominator
    Boolean forceProper

    SetToSum(Double, WrappedGaussian, Double, WrappedGaussian)

    Set the parameters to match the moments of a mixture distribution.

    Declaration
    public void SetToSum(double weight1, WrappedGaussian value1, double weight2, WrappedGaussian value2)
    Parameters
    Type Name Description
    Double weight1

    The first weight

    WrappedGaussian value1

    The first distribution

    Double weight2

    The second weight

    WrappedGaussian value2

    The second distribution

    SetToUniform()

    Set the distribution to uniform, keeping the same period

    Declaration
    public void SetToUniform()

    ToString()

    A human-readable string containing the parameters of the distribution

    Declaration
    public override string ToString()
    Returns
    Type Description
    String
    Overrides
    ValueType.ToString()

    Uniform(Double)

    Create a uniform WrappedGaussian distribution

    Declaration
    [Construction(new string[]{"Period"}, UseWhen = "IsUniform")]
    public static WrappedGaussian Uniform(double period = 6.2831853071795862)
    Parameters
    Type Name Description
    Double period
    Returns
    Type Description
    WrappedGaussian

    Operators

    Equality(WrappedGaussian, WrappedGaussian)

    Equals operator

    Declaration
    public static bool operator ==(WrappedGaussian a, WrappedGaussian b)
    Parameters
    Type Name Description
    WrappedGaussian a
    WrappedGaussian b
    Returns
    Type Description
    Boolean

    Inequality(WrappedGaussian, WrappedGaussian)

    Not equals operator

    Declaration
    public static bool operator !=(WrappedGaussian a, WrappedGaussian b)
    Parameters
    Type Name Description
    WrappedGaussian a
    WrappedGaussian b
    Returns
    Type Description
    Boolean

    Multiply(WrappedGaussian, WrappedGaussian)

    Creates a new WrappedGaussian which is the product of two other WrappedGaussians

    Declaration
    public static WrappedGaussian operator *(WrappedGaussian a, WrappedGaussian b)
    Parameters
    Type Name Description
    WrappedGaussian a

    First WrappedGaussian

    WrappedGaussian b

    Second WrappedGaussian

    Returns
    Type Description
    WrappedGaussian

    Result

    Implements

    IDistribution<T>
    IDistribution
    System.ICloneable
    Diffable
    SettableToUniform
    HasPoint<T>
    CanGetLogProb<T>
    SettableTo<T>
    SettableToProduct<T>
    SettableToProduct<T, U>
    SettableToRatio<T>
    SettableToRatio<T, U>
    SettableToWeightedSum<T>
    SettableToPower<T>
    Sampleable<T>
    CanGetLogAverageOf<T>
    CanGetLogAverageOfPower<T>
    CanGetAverageLog<T>
    In This Article
    Back to top Copyright © .NET Foundation. All rights reserved.