Search Results for

    Show / Hide Table of Contents

    Class Automaton<TSequence, TElement, TElementDistribution, TSequenceManipulator, TThis>.Simplification

    Helper class which which implements automaton simplification.

    Inheritance
    Object
    Automaton<TSequence, TElement, TElementDistribution, TSequenceManipulator, TThis>.Simplification
    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.Distributions.Automata
    Assembly: Microsoft.ML.Probabilistic.dll
    Syntax
    public class Simplification

    Constructors

    Simplification(Automaton<TSequence, TElement, TElementDistribution, TSequenceManipulator, TThis>.Builder, Nullable<Double>)

    Initializes new instance of Automaton<TSequence, TElement, TElementDistribution, TSequenceManipulator, TThis>.Simplification class.

    Declaration
    public Simplification(Automaton<TSequence, TElement, TElementDistribution, TSequenceManipulator, TThis>.Builder builder, double? pruneStatesWithLogEndWeightLessThan)
    Parameters
    Type Name Description
    Automaton.Builder<> builder
    Nullable<Double> pruneStatesWithLogEndWeightLessThan

    Methods

    MergeParallelTransitions()

    Merges outgoing transitions with the same destination state.

    Declaration
    public void MergeParallelTransitions()

    MergeTrees()

    Declaration
    public void MergeTrees()

    RemoveDeadStates()

    Optimizes the automaton by removing all states which can't reach end states.

    Declaration
    public bool RemoveDeadStates()
    Returns
    Type Description
    Boolean

    RemoveLowWeightEndStates()

    Declaration
    public void RemoveLowWeightEndStates()

    Simplify()

    Attempts to simplify the structure of the automaton, reducing the number of states and transitions.

    Declaration
    public bool Simplify()
    Returns
    Type Description
    Boolean
    Remarks

    Only generalized tree part of automaton is simplified. Generalized tree is a tree with self-loops allowed. Any non-trivial loops (consisting of more than 1 state) are left untouched.

    The simplification procedure works as follows:

    • If a pair of states has more than one transition between them, the transitions get merged.

    • A part of the automaton that is a tree is found. For example in this automaton: a--->b--->c--->d---
      v ^ | e--->f--->g --/ |
      v h--->i--->j-->k ^ | --/ Nodes "a" to "h" form the tree. Nodes "i" to "k" are not part of the tree. Note 1: h has child nodes which form loop (i, j) but is still considered a part of tree. Because path leading to it from root has no loops. Note 2: d is also considered to be a part of tree. Self-loops are allowed.

    • After that, states in the tree part of automaton are recursively merged if they are compatible. Two states are considered compatible if path from root to them has exactly same element distributions and groups on transitions, and they have compatible self-loops. Weights in transitions from root can be different - weights will be adjusted as necessary. For example if in previous automaton transitions (a-b) and (a-e) have the same element distribution then result will look like this:

      a--->b--->c--->d---\
      | \            ^   |
      

    e | f--->g --/ |
    v h--->i--->j-->k ^ | --/

    • If pruneStatesWithLogEndWeightLessThan is not null then log normalizer and graph condensation computed. All states which do not have high enough end probability are deleted

    SimplifyIfNeeded()

    Attempts to simplify the automaton using Simplify() if the number of states exceeds MaxStateCountBeforeSimplification.

    Declaration
    public bool SimplifyIfNeeded()
    Returns
    Type Description
    Boolean
    In This Article
    Back to top Copyright © .NET Foundation. All rights reserved.