Search Results for

    Show / Hide Table of Contents

    Class DistributionStructArray2D<T, DomainType>

    A distribution over a 2D array of type DomainType, where each element is independent and has distribution of type T

    Inheritance
    Object
    ArrayBase<T>
    Array2D<T>
    DistributionArray2D<T>
    DistributionArray2D<T, DomainType>
    DistributionStructArray2D<T, DomainType>
    Implements
    CanSetAllElementsTo<T>
    IReadOnlyList<T>
    IReadOnlyCollection<T>
    IArray2D<T>
    IArray<T>
    IList<T>
    ICollection<T>
    IEnumerable<T>
    IEnumerable
    SettableTo<T[,]>
    SettableTo<Array2D<T>>
    ConvertibleToArray
    IDistribution<DomainType[,]>
    IDistribution
    ICloneable
    Diffable
    SettableToUniform
    HasPoint<DomainType[,]>
    CanGetLogProb<DomainType[,]>
    Sampleable<DomainType[,]>
    SettableTo<DistributionStructArray2D<T, DomainType>>
    SettableToProduct<DistributionStructArray2D<T, DomainType>>
    SettableToProduct<DistributionStructArray2D<T, DomainType>, DistributionStructArray2D<T, DomainType>>
    SettableToRatio<DistributionStructArray2D<T, DomainType>>
    SettableToRatio<DistributionStructArray2D<T, DomainType>, DistributionStructArray2D<T, DomainType>>
    SettableToPower<DistributionStructArray2D<T, DomainType>>
    SettableToWeightedSum<DistributionStructArray2D<T, DomainType>>
    CanGetLogAverageOf<DistributionStructArray2D<T, DomainType>>
    CanGetLogAverageOfPower<DistributionStructArray2D<T, DomainType>>
    CanGetAverageLog<DistributionStructArray2D<T, DomainType>>
    Inherited Members
    DistributionArray2D<T, DomainType>.Point
    DistributionArray2D<T, DomainType>.IsPointMass
    DistributionArray2D<T, DomainType>.GetLogProb(DomainType[,])
    DistributionArray2D<T, DomainType>.Sample()
    DistributionArray2D<T, DomainType>.Sample(DomainType[,])
    DistributionArray2D<T>.SetToUniform()
    DistributionArray2D<T>.IsUniform()
    Array2D<T>.Length0
    Array2D<T>.Length1
    Array2D<T>.SetTo(T[,])
    Array2D<T>.SetTo(Array2D<T>)
    Array2D<T>.CopyTo(T[,])
    Array2D<T>.ToArray()
    Array2D<T>.ConvertibleToArray.ToArray()
    Array2D<T>.ToArray<TOutput>(Converter<T, TOutput>, Array2D<T>)
    Array2D<T>.ToString()
    Array2D<T>.Item[Int32, Int32]
    Array2D<T>.Rank
    Array2D<T>.GetLength(Int32)
    Array2D<T>.Equals(Object)
    Array2D<T>.GetHashCode()
    Array2D<T>.ForEach<U>(U[,], Action<T, U>)
    Array2D<T>.ForEach<U, V>(U[,], V[,], Action<T, U, V>)
    Array2D<T>.ModifyAll<U>(U[,], Func<T, U, T>)
    Array2D<T>.ModifyAll<U, V>(U[,], V[,], Func<T, U, V, T>)
    ArrayBase<T>.array
    ArrayBase<T>.Item[Int32]
    ArrayBase<T>.IndexOf(T)
    ArrayBase<T>.Insert(Int32, T)
    ArrayBase<T>.RemoveAt(Int32)
    ArrayBase<T>.Add(T)
    ArrayBase<T>.Clear()
    ArrayBase<T>.Contains(T)
    ArrayBase<T>.CopyTo(T[], Int32)
    ArrayBase<T>.Count
    ArrayBase<T>.IsReadOnly
    ArrayBase<T>.Remove(T)
    ArrayBase<T>.GetEnumerator()
    ArrayBase<T>.IEnumerable.GetEnumerator()
    ArrayBase<T>.CheckCompatible(IArray<T>)
    ArrayBase<T>.SetAllElementsTo(T)
    ArrayBase<T>.FindIndex(Predicate<T>)
    ArrayBase<T>.ForEach(Action<T>)
    ArrayBase<T>.ForEach<U>(U[], Action<T, U>)
    ArrayBase<T>.ForEach<U, V>(U[], V[], Action<T, U, V>)
    ArrayBase<T>.SetToFunction<U>(U[], Func<U, T>)
    ArrayBase<T>.SetToFunction<U>(ArrayBase<U>, Func<U, T>)
    ArrayBase<T>.SetToFunction<U, V>(ArrayBase<U>, V[], Func<U, V, T>)
    ArrayBase<T>.SetToFunction<U, V, W>(ArrayBase<U>, V[], W[], Func<U, V, W, T>)
    Object.Equals(Object, Object)
    Object.GetType()
    Object.MemberwiseClone()
    Object.ReferenceEquals(Object, Object)
    Namespace: Microsoft.ML.Probabilistic.Distributions
    Assembly: Microsoft.ML.Probabilistic.dll
    Syntax
    [Serializable]
    [Quality(QualityBand.Mature)]
    [DataContract]
    public class DistributionStructArray2D<T, DomainType> : DistributionArray2D<T, DomainType>, CanSetAllElementsTo<T>, IReadOnlyList<T>, IReadOnlyCollection<T>, IArray2D<T>, IArray<T>, IList<T>, ICollection<T>, IEnumerable<T>, IEnumerable, SettableTo<T[, ]>, SettableTo<Array2D<T>>, ConvertibleToArray, IDistribution<DomainType[, ]>, IDistribution, ICloneable, Diffable, SettableToUniform, HasPoint<DomainType[, ]>, CanGetLogProb<DomainType[, ]>, Sampleable<DomainType[, ]>, SettableTo<DistributionStructArray2D<T, DomainType>>, SettableToProduct<DistributionStructArray2D<T, DomainType>>, SettableToProduct<DistributionStructArray2D<T, DomainType>, DistributionStructArray2D<T, DomainType>>, SettableToRatio<DistributionStructArray2D<T, DomainType>>, SettableToRatio<DistributionStructArray2D<T, DomainType>, DistributionStructArray2D<T, DomainType>>, SettableToPower<DistributionStructArray2D<T, DomainType>>, SettableToWeightedSum<DistributionStructArray2D<T, DomainType>>, CanGetLogAverageOf<DistributionStructArray2D<T, DomainType>>, CanGetLogAverageOfPower<DistributionStructArray2D<T, DomainType>>, CanGetAverageLog<DistributionStructArray2D<T, DomainType>> where T : struct, SettableToUniform, Diffable, SettableToProduct<T>, SettableToRatio<T>, SettableToPower<T>, SettableToWeightedSum<T>, CanGetLogAverageOf<T>, CanGetLogAverageOfPower<T>, CanGetAverageLog<T>, IDistribution<DomainType>, Sampleable<DomainType>
    Type Parameters
    Name Description
    T

    Distribution type of an element. Must be a value type all the way down, i.e. must not hold any references.

    DomainType

    Domain type of an element

    Remarks

    This is an extension of DistributionArray that requires T to be a value type. This class only exists for efficiency, to avoid unnecessary cloning.

    Constructors

    DistributionStructArray2D()

    Parameterless constructor needed for serialization

    Declaration
    protected DistributionStructArray2D()

    DistributionStructArray2D(T, Int32, Int32)

    Constructs a new 2-D distribution array given the lengths of each dimension, and a value

    Declaration
    public DistributionStructArray2D(T value, int length0, int length1)
    Parameters
    Type Name Description
    T value
    Int32 length0
    Int32 length1

    DistributionStructArray2D(T[,])

    Constructs a new 2-D distribution array given a 2-D array of distributions

    Declaration
    public DistributionStructArray2D(T[, ] array)
    Parameters
    Type Name Description
    T[,] array

    DistributionStructArray2D(Array2D<T>)

    Copy constructor

    Declaration
    public DistributionStructArray2D(Array2D<T> that)
    Parameters
    Type Name Description
    Array2D<T> that

    DistributionStructArray2D(Int32, Int32)

    Constructs a new 2-D distribution array given the lengths of each dimension

    Declaration
    public DistributionStructArray2D(int length0, int length1)
    Parameters
    Type Name Description
    Int32 length0
    Int32 length1

    DistributionStructArray2D(Int32, Int32, T[])

    Constructs a new 2-D distribution array given the lengths of each dimension, and an array of values to reference

    Declaration
    public DistributionStructArray2D(int length0, int length1, T[] valuesRef)
    Parameters
    Type Name Description
    Int32 length0
    Int32 length1
    T[] valuesRef

    Array of values to reference

    DistributionStructArray2D(Int32, Int32, Func<Int32, Int32, T>)

    Constructs a new 2-D distribution array given the lengths of each dimension and initial values.

    Declaration
    public DistributionStructArray2D(int length0, int length1, Func<int, int, T> init)
    Parameters
    Type Name Description
    Int32 length0
    Int32 length1
    Func<Int32, Int32, T> init

    Function that maps an index to a value.

    Methods

    Clone()

    Clone the distribution

    Declaration
    public override object Clone()
    Returns
    Type Description
    Object
    Overrides
    Microsoft.ML.Probabilistic.Collections.Array2D<T>.Clone()

    GetAverageLog(DistributionStructArray2D<T, DomainType>)

    The expected logarithm of that distribution under this distribution.

    Declaration
    public double GetAverageLog(DistributionStructArray2D<T, DomainType> that)
    Parameters
    Type Name Description
    DistributionStructArray2D<T, DomainType> that

    The distribution to take the logarithm of.

    Returns
    Type Description
    Double

    sum_x this.Evaluate(x)*Math.Log(that.Evaluate(x))

    Remarks

    This is also known as the cross entropy.

    GetLogAverageOf(DistributionStructArray2D<T, DomainType>)

    The log-probability that two distributions would draw the same sample.

    Declaration
    public double GetLogAverageOf(DistributionStructArray2D<T, DomainType> that)
    Parameters
    Type Name Description
    DistributionStructArray2D<T, DomainType> that
    Returns
    Type Description
    Double

    Math.Log(sum_x this.Evaluate(x)*that.Evaluate(x))

    Remarks

    This can be considered a type of inner product between distributions. Another name might be "LogAverage" to go with "GetAverageLog".

    GetLogAverageOfPower(DistributionStructArray2D<T, DomainType>, Double)

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

    Declaration
    public double GetLogAverageOfPower(DistributionStructArray2D<T, DomainType> that, double power)
    Parameters
    Type Name Description
    DistributionStructArray2D<T, DomainType> that
    Double power
    Returns
    Type Description
    Double

    MaxDiff(Object)

    The maximum difference in parameters between this distribution array and that distribution array

    Declaration
    public override double MaxDiff(object that)
    Parameters
    Type Name Description
    Object that

    That distribution array

    Returns
    Type Description
    Double

    The maximum difference

    Overrides
    Microsoft.ML.Probabilistic.Distributions.DistributionArray2D<T>.MaxDiff(System.Object)

    PointMass(DomainType[,])

    Creates a distribution containing a single point.

    Declaration
    public static DistributionStructArray2D<T, DomainType> PointMass(DomainType[, ] value)
    Parameters
    Type Name Description
    DomainType[,] value

    The point

    Returns
    Type Description
    DistributionStructArray2D<T, DomainType>

    Sample(DomainType[,])

    Sample from the distribution

    Declaration
    public override DomainType[, ] Sample(DomainType[, ] result)
    Parameters
    Type Name Description
    DomainType[,] result

    Where to put the result

    Returns
    Type Description
    DomainType[,]

    A sample

    Overrides
    Microsoft.ML.Probabilistic.Distributions.DistributionArray2D<T, DomainType>.Sample(DomainType[,])

    SetTo(DistributionStructArray2D<T, DomainType>)

    Set the parameters of this distribution to match those of the given distribution (by value)

    Declaration
    public void SetTo(DistributionStructArray2D<T, DomainType> that)
    Parameters
    Type Name Description
    DistributionStructArray2D<T, DomainType> that

    SetToPower(DistributionStructArray2D<T, DomainType>, Double)

    Set the parameters to represent the power of a source distribution to some exponent

    Declaration
    public void SetToPower(DistributionStructArray2D<T, DomainType> a, double exponent)
    Parameters
    Type Name Description
    DistributionStructArray2D<T, DomainType> a

    The source distribution array

    Double exponent

    The exponent

    SetToProduct(DistributionStructArray2D<T, DomainType>, DistributionStructArray2D<T, DomainType>)

    Set the parameters to represent the product of two distributions

    Declaration
    public void SetToProduct(DistributionStructArray2D<T, DomainType> a, DistributionStructArray2D<T, DomainType> b)
    Parameters
    Type Name Description
    DistributionStructArray2D<T, DomainType> a

    The first distribution

    DistributionStructArray2D<T, DomainType> b

    The second distribution

    SetToRatio(DistributionStructArray2D<T, DomainType>, DistributionStructArray2D<T, DomainType>, Boolean)

    Set the parameters to represent the ratio of two distributions

    Declaration
    public void SetToRatio(DistributionStructArray2D<T, DomainType> numerator, DistributionStructArray2D<T, DomainType> denominator, bool forceProper)
    Parameters
    Type Name Description
    DistributionStructArray2D<T, DomainType> numerator

    The numerator distribution array

    DistributionStructArray2D<T, DomainType> denominator

    The denominator distribution array

    Boolean forceProper

    SetToSum(Double, DistributionStructArray2D<T, DomainType>, Double, DistributionStructArray2D<T, DomainType>)

    Set the parameters to match the moments of a mixture of two distributions

    Declaration
    public void SetToSum(double weight1, DistributionStructArray2D<T, DomainType> a, double weight2, DistributionStructArray2D<T, DomainType> b)
    Parameters
    Type Name Description
    Double weight1

    The first weight

    DistributionStructArray2D<T, DomainType> a

    The first distribution array

    Double weight2

    The second weight

    DistributionStructArray2D<T, DomainType> b

    The second distribution array

    Implements

    CanSetAllElementsTo<T>
    System.Collections.Generic.IReadOnlyList<T>
    System.Collections.Generic.IReadOnlyCollection<T>
    IArray2D<T>
    IArray<T>
    System.Collections.Generic.IList<T>
    System.Collections.Generic.ICollection<T>
    System.Collections.Generic.IEnumerable<T>
    System.Collections.IEnumerable
    SettableTo<T>
    SettableTo<T>
    ConvertibleToArray
    IDistribution<T>
    IDistribution
    System.ICloneable
    Diffable
    SettableToUniform
    HasPoint<T>
    CanGetLogProb<T>
    Sampleable<T>
    SettableTo<T>
    SettableToProduct<T>
    SettableToProduct<T, U>
    SettableToRatio<T>
    SettableToRatio<T, U>
    SettableToPower<T>
    SettableToWeightedSum<T>
    CanGetLogAverageOf<T>
    CanGetLogAverageOfPower<T>
    CanGetAverageLog<T>

    Extension Methods

    CollectionExtensions.AddRange<T>(ICollection<T>, IEnumerable<T>)
    CollectionExtensions.ContainsAll<T>(ICollection<T>, IEnumerable<T>)
    CollectionExtensions.ContainsAny<T>(ICollection<T>, IEnumerable<T>)
    EnumerableExtensions.ForEach<T>(IEnumerable<T>, Action<T>)
    EnumerableExtensions.ForEach<T>(IEnumerable, Action<T>)
    EnumerableExtensions.ForEach<T>(IEnumerable<T>, Action<Int32, T>)
    EnumerableExtensions.ForEach<T>(IEnumerable, Action<Int32, T>)
    EnumerableExtensions.Sum<TSource>(IEnumerable<TSource>, Func<TSource, UInt32>)
    EnumerableExtensions.Sum<TSource>(IEnumerable<TSource>, Func<TSource, UInt64>)
    EnumerableExtensions.ValueEquals<T>(IEnumerable<T>, IEnumerable<T>)
    EnumerableExtensions.IndexOf<T>(IEnumerable<T>, T)
    EnumerableExtensions.IndexOf<T>(IEnumerable, T)
    EnumerableExtensions.FindIndex<T>(IEnumerable<T>, Predicate<T>)
    EnumerableExtensions.FindIndex<T>(IEnumerable, Predicate<T>)
    EnumerableExtensions.FindAllIndex<T>(IEnumerable<T>, Predicate<T>)
    EnumerableExtensions.IndexOfAll<T>(IEnumerable<T>, T)
    EnumerableExtensions.Skip<T>(IEnumerable<T>, Int32, out List<T>)
    EnumerableExtensions.CopyTo<T>(IEnumerable<T>, T[], Int32)
    EnumerableExtensions.ToReadOnlyList<T>(IEnumerable<T>)
    IEnumerableExensions.EnumerableReduce<T, TRes>(IEnumerable<T>, TRes, Func<TRes, T, TRes>, Func<TRes, T, Int32, TRes>)
    IEnumerableExensions.EnumerableSum<T>(IEnumerable<T>, Func<T, Double>)
    IEnumerableExensions.ListZip<TFirst, TSecond, TResult>(IList<TFirst>, IEnumerable<TSecond>, Func<TFirst, TSecond, TResult>)
    IEnumerableExensions.ListZip<TFirst, TSecond, TThird, TResult>(IList<TFirst>, IEnumerable<TSecond>, IEnumerable<TThird>, Func<TFirst, TSecond, TThird, TResult>)
    IEnumerableExensions.ListZip<TFirst, TSecond, TThird, TFourth, TResult>(IList<TFirst>, IList<TSecond>, IList<TThird>, IList<TFourth>, Func<TFirst, TSecond, TThird, TFourth, TResult>)
    IListExtensions.IsSparse<T>(IList<T>)
    IListExtensions.ListSelect<T, T2>(IList<T>, Func<T, T2>)
    IListExtensions.ListReduce<T, TRes>(IList<T>, TRes, Func<TRes, T, TRes>)
    IListExtensions.ListReduce<T, T2, TRes>(IList<T>, IEnumerable<T2>, TRes, Func<TRes, T, T2, TRes>)
    IListExtensions.SetTo<T>(IList<T>, IEnumerable<T>)
    IListExtensions.AsReadOnly<T>(IList<T>)
    ReadOnlyArray.ToReadOnlyArray<T>(IEnumerable<T>)
    In This Article
    Back to top Copyright © .NET Foundation. All rights reserved.