Search Results for

    Show / Hide Table of Contents

    Class WeightFunctions<TSequence, TElement, TElementDistribution, TSequenceManipulator, TAutomaton>.PointMassWeightFunction

    An implementation of WeightFunctions<TSequence, TElement, TElementDistribution, TSequenceManipulator, TAutomaton>.IWeightFunction<TThis> that represents a point mass weight function, aka a weight function that maps one sequence to 1.0 and all other sequences to zero.

    Inheritance
    Object
    WeightFunctions<TSequence, TElement, TElementDistribution, TSequenceManipulator, TAutomaton>.PointMassWeightFunction
    Implements
    WeightFunctions.IWeightFunction<WeightFunctions.PointMassWeightFunction<>>
    WeightFunctions.IWeightFunction<>
    IEquatable<WeightFunctions.PointMassWeightFunction<>>
    Inherited Members
    Object.Equals(Object, Object)
    Object.GetType()
    Object.MemberwiseClone()
    Object.ReferenceEquals(Object, Object)
    Namespace: Microsoft.ML.Probabilistic.Distributions.Automata
    Assembly: Microsoft.ML.Probabilistic.dll
    Syntax
    [Serializable]
    [DataContract]
    [Quality(QualityBand.Experimental)]
    public sealed class PointMassWeightFunction : WeightFunctions<TSequence, TElement, TElementDistribution, TSequenceManipulator, TAutomaton>.IWeightFunction<WeightFunctions<TSequence, TElement, TElementDistribution, TSequenceManipulator, TAutomaton>.PointMassWeightFunction>, WeightFunctions<TSequence, TElement, TElementDistribution, TSequenceManipulator, TAutomaton>.IWeightFunction, IEquatable<WeightFunctions<TSequence, TElement, TElementDistribution, TSequenceManipulator, TAutomaton>.PointMassWeightFunction>

    Properties

    IsPointMass

    Gets a value indicating whether the current weight function assigns a non-zero weight to exactly one point.

    Declaration
    public bool IsPointMass { get; }
    Property Value
    Type Description
    Boolean

    Point

    Gets the only point to which the current function assigns a non-zero weight.

    Declaration
    public TSequence Point { get; }
    Property Value
    Type Description
    TSequence

    UsesAutomatonRepresentation

    Gets a value indicating whether the current weight function is represented as an automaton internally.

    Declaration
    public bool UsesAutomatonRepresentation { get; }
    Property Value
    Type Description
    Boolean

    UsesGroups

    Checks if the weight function uses groups.

    Declaration
    public bool UsesGroups { get; }
    Property Value
    Type Description
    Boolean

    true if the weight function uses groups, false otherwise.

    Methods

    Append(TSequence, Int32)

    Creates a weight function f'(st) = f(s), where f(s) is the current weight function and t is the given sequence.

    Declaration
    public WeightFunctions<TSequence, TElement, TElementDistribution, TSequenceManipulator, TAutomaton>.PointMassWeightFunction Append(TSequence sequence, int group = 0)
    Parameters
    Type Name Description
    TSequence sequence

    The sequence.

    Int32 group

    The group.

    Returns
    Type Description
    WeightFunctions.PointMassWeightFunction<>

    The created weight function.

    Remarks

    WeightFunctions<TSequence, TElement, TElementDistribution, TSequenceManipulator, TAutomaton>.PointMassWeightFunction only supports case group == 0.

    Append(WeightFunctions<TSequence, TElement, TElementDistribution, TSequenceManipulator, TAutomaton>.PointMassWeightFunction, Int32)

    Creates a weight function f'(s) = sum_{tu=s} f(t)g(u), where f(t) is the current weight function and g(u) is the given weight function.

    Declaration
    public WeightFunctions<TSequence, TElement, TElementDistribution, TSequenceManipulator, TAutomaton>.PointMassWeightFunction Append(WeightFunctions<TSequence, TElement, TElementDistribution, TSequenceManipulator, TAutomaton>.PointMassWeightFunction weightFunction, int group = 0)
    Parameters
    Type Name Description
    WeightFunctions.PointMassWeightFunction<> weightFunction
    Int32 group

    The group.

    Returns
    Type Description
    WeightFunctions.PointMassWeightFunction<>

    The created weight function.

    Remarks

    WeightFunctions<TSequence, TElement, TElementDistribution, TSequenceManipulator, TAutomaton>.PointMassWeightFunction only supports case group == 0.

    AsAutomaton()

    Returns an automaton representation of the current weight function. If the weight function is normalized, the resulting automaton is stochastic, i.e. the sum of weights of all the outgoing transitions and the ending weight is 1 for every node.

    Declaration
    public TAutomaton AsAutomaton()
    Returns
    Type Description
    TAutomaton

    EnumeratePaths()

    Enumerates paths through this weight function.

    Declaration
    public IEnumerable<Tuple<List<TElementDistribution>, double>> EnumeratePaths()
    Returns
    Type Description
    IEnumerable<Tuple<List<TElementDistribution>, Double>>

    The paths through this weight function, with their log weights

    EnumerateSupport(Int32)

    Enumerates support of this weight function when possible.

    Declaration
    public IEnumerable<TSequence> EnumerateSupport(int maxCount = 1000000)
    Parameters
    Type Name Description
    Int32 maxCount

    The maximum support enumeration count.

    Returns
    Type Description
    IEnumerable<TSequence>

    The sequences in the support of this weight function

    Exceptions
    Type Condition
    AutomatonEnumerationCountException

    Thrown if enumeration is too large.

    Equals(WeightFunctions<TSequence, TElement, TElementDistribution, TSequenceManipulator, TAutomaton>.PointMassWeightFunction)

    Declaration
    public bool Equals(WeightFunctions<TSequence, TElement, TElementDistribution, TSequenceManipulator, TAutomaton>.PointMassWeightFunction other)
    Parameters
    Type Name Description
    WeightFunctions.PointMassWeightFunction<> other
    Returns
    Type Description
    Boolean

    Equals(Object)

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

    FromPoint(TSequence)

    Creates a point mass weight function.

    Declaration
    [Construction(new string[]{"Point"})]
    public static WeightFunctions<TSequence, TElement, TElementDistribution, TSequenceManipulator, TAutomaton>.PointMassWeightFunction FromPoint(TSequence point)
    Parameters
    Type Name Description
    TSequence point

    The point.

    Returns
    Type Description
    WeightFunctions.PointMassWeightFunction<>

    The created point mass weight function.

    GetGroups()

    If the current weight function uses groups, returns a dictionary [group index] -> group. Otherwise, returns an empty dictionary.

    Declaration
    public Dictionary<int, WeightFunctions<TSequence, TElement, TElementDistribution, TSequenceManipulator, TAutomaton>.PointMassWeightFunction> GetGroups()
    Returns
    Type Description
    Dictionary<Int32, WeightFunctions.PointMassWeightFunction<>>

    A possibly empty dictionary [group index] -> group.

    GetHashCode()

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

    GetLogNormalizer()

    Computes the logarithm of the normalizer (sum of values of the weight function on all sequences).

    Declaration
    public double GetLogNormalizer()
    Returns
    Type Description
    Double

    The logarithm of the normalizer.

    Remarks

    Returns PositiveInfinity if the sum diverges.

    GetLogValue(TSequence)

    Computes the logarithm of the value of the weight function on a given sequence.

    Declaration
    public double GetLogValue(TSequence sequence)
    Parameters
    Type Name Description
    TSequence sequence

    The sequence to compute the value on.

    Returns
    Type Description
    Double

    The logarithm of the value.

    HasGroup(Int32)

    Determines whether this weight function has the specified group (if applicable).

    Declaration
    public bool HasGroup(int group)
    Parameters
    Type Name Description
    Int32 group

    The specified group.

    Returns
    Type Description
    Boolean

    True if it the weight function has this group, false otherwise.

    IsZero()

    Checks whether the current weight function is zero on all sequences.

    Declaration
    public bool IsZero()
    Returns
    Type Description
    Boolean

    true if the current weight function is zero on all sequences, false otherwise.

    MaxDiff(WeightFunctions<TSequence, TElement, TElementDistribution, TSequenceManipulator, TAutomaton>.PointMassWeightFunction)

    Gets a value indicating how close this weight function is to a given one in terms of weights they assign to sequences.

    Declaration
    public double MaxDiff(WeightFunctions<TSequence, TElement, TElementDistribution, TSequenceManipulator, TAutomaton>.PointMassWeightFunction that)
    Parameters
    Type Name Description
    WeightFunctions.PointMassWeightFunction<> that
    Returns
    Type Description
    Double

    A non-negative value, which is close to zero if the two weight functions assign similar values to all sequences.

    NormalizeStructure()

    Returns the weight function converted to the normalized form e.g. using special case structures for point masses and functions with small support.

    Declaration
    public WeightFunctions<TSequence, TElement, TElementDistribution, TSequenceManipulator, TAutomaton>.PointMassWeightFunction NormalizeStructure()
    Returns
    Type Description
    WeightFunctions.PointMassWeightFunction<>

    Product(WeightFunctions<TSequence, TElement, TElementDistribution, TSequenceManipulator, TAutomaton>.PointMassWeightFunction)

    Computes the product of the current weight function and a given one.

    Declaration
    public WeightFunctions<TSequence, TElement, TElementDistribution, TSequenceManipulator, TAutomaton>.PointMassWeightFunction Product(WeightFunctions<TSequence, TElement, TElementDistribution, TSequenceManipulator, TAutomaton>.PointMassWeightFunction weightFunction)
    Parameters
    Type Name Description
    WeightFunctions.PointMassWeightFunction<> weightFunction
    Returns
    Type Description
    WeightFunctions.PointMassWeightFunction<>

    The computed product.

    Remarks

    WeightFunctions<TSequence, TElement, TElementDistribution, TSequenceManipulator, TAutomaton>.PointMassWeightFunction only supports case weightFunction == langword_csharp_this.

    Repeat(Int32, Nullable<Int32>)

    Creates a weight function g(s) = sum_{k=Kmin}^{Kmax} sum_{t1 t2 ... tk = s} f(t1)f(t2)...f(tk), where f(t) is the current weight function, and Kmin and Kmax are the minimum and the maximum number of factors in a sum term.

    Declaration
    public WeightFunctions<TSequence, TElement, TElementDistribution, TSequenceManipulator, TAutomaton>.PointMassWeightFunction Repeat(int minTimes = 1, int? maxTimes = null)
    Parameters
    Type Name Description
    Int32 minTimes

    The minimum number of factors in a sum term. Defaults to 1.

    Nullable<Int32> maxTimes

    An optional maximum number of factors in a sum term.

    Returns
    Type Description
    WeightFunctions.PointMassWeightFunction<>

    The created weight function.

    Remarks

    Not supported for WeightFunctions<TSequence, TElement, TElementDistribution, TSequenceManipulator, TAutomaton>.PointMassWeightFunction.

    ScaleLog(Double)

    Scales the weight function and returns the result.

    Declaration
    public WeightFunctions<TSequence, TElement, TElementDistribution, TSequenceManipulator, TAutomaton>.PointMassWeightFunction ScaleLog(double logScale)
    Parameters
    Type Name Description
    Double logScale

    The logarithm of the scale.

    Returns
    Type Description
    WeightFunctions.PointMassWeightFunction<>

    The scaled weight function.

    Remarks

    Not supported for WeightFunctions<TSequence, TElement, TElementDistribution, TSequenceManipulator, TAutomaton>.PointMassWeightFunction.

    Sum(WeightFunctions<TSequence, TElement, TElementDistribution, TSequenceManipulator, TAutomaton>.PointMassWeightFunction)

    Computes the sum of the current weight function and a given weight function.

    Declaration
    public WeightFunctions<TSequence, TElement, TElementDistribution, TSequenceManipulator, TAutomaton>.PointMassWeightFunction Sum(WeightFunctions<TSequence, TElement, TElementDistribution, TSequenceManipulator, TAutomaton>.PointMassWeightFunction weightFunction)
    Parameters
    Type Name Description
    WeightFunctions.PointMassWeightFunction<> weightFunction
    Returns
    Type Description
    WeightFunctions.PointMassWeightFunction<>

    The computed sum.

    Remarks

    Not supported for WeightFunctions<TSequence, TElement, TElementDistribution, TSequenceManipulator, TAutomaton>.PointMassWeightFunction.

    Sum(Double, WeightFunctions<TSequence, TElement, TElementDistribution, TSequenceManipulator, TAutomaton>.PointMassWeightFunction, Double)

    Computes the weighted sum of the current weight function and a given weight function.

    Declaration
    public WeightFunctions<TSequence, TElement, TElementDistribution, TSequenceManipulator, TAutomaton>.PointMassWeightFunction Sum(double weight1, WeightFunctions<TSequence, TElement, TElementDistribution, TSequenceManipulator, TAutomaton>.PointMassWeightFunction weightFunction, double weight2)
    Parameters
    Type Name Description
    Double weight1

    The weight of the current weight function.

    WeightFunctions.PointMassWeightFunction<> weightFunction
    Double weight2

    The weight of the weightFunction.

    Returns
    Type Description
    WeightFunctions.PointMassWeightFunction<>
    Remarks

    Not supported for WeightFunctions<TSequence, TElement, TElementDistribution, TSequenceManipulator, TAutomaton>.PointMassWeightFunction.

    SumLog(Double, WeightFunctions<TSequence, TElement, TElementDistribution, TSequenceManipulator, TAutomaton>.PointMassWeightFunction, Double)

    Computes the weighted sum of the current weight function and a given weight function.

    Declaration
    public WeightFunctions<TSequence, TElement, TElementDistribution, TSequenceManipulator, TAutomaton>.PointMassWeightFunction SumLog(double logWeight1, WeightFunctions<TSequence, TElement, TElementDistribution, TSequenceManipulator, TAutomaton>.PointMassWeightFunction weightFunction, double logWeight2)
    Parameters
    Type Name Description
    Double logWeight1

    The logarithm of the weight of the current weight function.

    WeightFunctions.PointMassWeightFunction<> weightFunction
    Double logWeight2

    The logarithm of the weight of the weightFunction.

    Returns
    Type Description
    WeightFunctions.PointMassWeightFunction<>
    Remarks

    Not supported for WeightFunctions<TSequence, TElement, TElementDistribution, TSequenceManipulator, TAutomaton>.PointMassWeightFunction.

    ToString()

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

    ToString(Action<TElementDistribution, StringBuilder>)

    Returns a string that represents the weight function.

    Declaration
    public string ToString(Action<TElementDistribution, StringBuilder> appendElement)
    Parameters
    Type Name Description
    Action<TElementDistribution, StringBuilder> appendElement

    Optional method for appending at the element distribution level.

    Returns
    Type Description
    String

    A string that represents the weight function.

    TryEnumerateSupport(Int32, out IEnumerable<TSequence>)

    Tries to enumerate support of this weight function.

    Declaration
    public bool TryEnumerateSupport(int maxCount, out IEnumerable<TSequence> result)
    Parameters
    Type Name Description
    Int32 maxCount

    The maximum support enumeration count.

    IEnumerable<TSequence> result

    The sequences in the support of this weight function

    Returns
    Type Description
    Boolean

    True if successful, false otherwise

    TryNormalizeValues(out WeightFunctions<TSequence, TElement, TElementDistribution, TSequenceManipulator, TAutomaton>.PointMassWeightFunction, out Double)

    Attempts to normalize the weight function so that sum of its values on all possible sequences equals to one (if it is possible) and returns the result in an out parameter. If successful, calls to AsAutomaton() methods of the resulting function produce a stochastic automaton, i.e. an automaton, in which the sum of weights of all the outgoing transitions and the ending weight is 1 for every node.

    Declaration
    public bool TryNormalizeValues(out WeightFunctions<TSequence, TElement, TElementDistribution, TSequenceManipulator, TAutomaton>.PointMassWeightFunction normalizedFunction, out double logNormalizer)
    Parameters
    Type Name Description
    WeightFunctions.PointMassWeightFunction<> normalizedFunction
    Double logNormalizer

    When the function returns, contains the logarithm of the normalizer.

    Returns
    Type Description
    Boolean

    true if the weight function was successfully normalized, false otherwise.

    Implements

    WeightFunctions<TSequence, TElement, TElementDistribution, TSequenceManipulator, TAutomaton>.IWeightFunction<TThis>
    WeightFunctions<TSequence, TElement, TElementDistribution, TSequenceManipulator, TAutomaton>.IWeightFunction
    System.IEquatable<T>
    In This Article
    Back to top Copyright © .NET Foundation. All rights reserved.