Class

de.sciss.fscape.graph

Viterbi

Related Doc: package graph

Permalink

final case class Viterbi(mul: GE = 1.0, add: GE, numStates: GE, numFrames: GE = 1) extends SingleOut with Product with Serializable

A UGen performing a generalized Viterbi algorithm. The Viterbi algorithm tries to find the best path among sequences of states, by evaluating transition probabilities. It runs over a predefined number of frames, accumulating data of different states. It maximizes the likelihood of the terminal state, and then backtracks to reconstruct the likely path (sequence of states). The output is the sequence of state indices (from zero inclusive to numStates exclusive).

Note: This UGen must run until numFrames or the inputs are exhausted, before it can begin outputting values.

This implementation is generalized in the sense that instead of the canonical matrices "sequences of observations", "initial probabilities", "transition matrix", and "emission matrix", it takes two large matrices mul and add that contain the equivalent information. These two matrices allow the UGen to operate in two different modes:

- multiplicative (as in the Wikipedia article) by damping the probabilities over time - accumulative (as used in Praat for pitch tracking) by adding up the weights (if you have "costs", feed in their negative values).

Basically the internal delta matrix is created by the update function delta = (delta_prev * mul) + add (with the corresponding matrix indices).

The initial delta state is zero. Therefore, in order to provide the initial state, you obtain an initial vector v by providing an add matrix of numStates x numStates cells, which is zero except for the first column filled by v (alternatively, each row filled with the next value of v, or a diagonal matrix of v; if v can take negative value, make sure to fill the initial numStates x numStates completely by duplicating v).

For the classical data, set add just to the initial matrix as explained above (multiplying emitted first observations with initial probabilities), and then use exclusively mul by passing in emitted observations multiplied by their transition probabilities:

mul[t][i][j] = transitionProb[i][j] * emissionProb[observation[t]][i]

See https://en.wikipedia.org/wiki/Viterbi_algorithm

mul

the generalized multiplicative matrix (combining transition probabilities, emission probabilities and observations). If only accumulation is used, set this to 1.0.

add

the generalized accumulative matrix (combining transition probabilities, emission probabilities and observations). If only multiplication is used, set this to provide the initial state (see above), followed either by zeroes or by terminating the signal.

numStates

the number of different states, as reflected by the inner dimensions of matrices mul and add.

numFrames

the number of observations. If -1, the UGen runs until the input is exhausted. This happens when both mul and add end. see StrongestLocalMaxima see PitchesToViterbi

Linear Supertypes
Serializable, Serializable, SingleOut, SomeOut[StreamOut], GE.Lazy, GE, UGenSource[UGenInLike, StreamOut], Expander[UGenInLike], Lazy, Product, Equals, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Viterbi
  2. Serializable
  3. Serializable
  4. SingleOut
  5. SomeOut
  6. Lazy
  7. GE
  8. UGenSource
  9. Expander
  10. Lazy
  11. Product
  12. Equals
  13. AnyRef
  14. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new Viterbi(mul: GE = 1.0, add: GE, numStates: GE, numFrames: GE = 1)

    Permalink

    mul

    the generalized multiplicative matrix (combining transition probabilities, emission probabilities and observations). If only accumulation is used, set this to 1.0.

    add

    the generalized accumulative matrix (combining transition probabilities, emission probabilities and observations). If only multiplication is used, set this to provide the initial state (see above), followed either by zeroes or by terminating the signal.

    numStates

    the number of different states, as reflected by the inner dimensions of matrices mul and add.

    numFrames

    the number of observations. If -1, the UGen runs until the input is exhausted. This happens when both mul and add end. see StrongestLocalMaxima see PitchesToViterbi

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. val add: GE

    Permalink

    the generalized accumulative matrix (combining transition probabilities, emission probabilities and observations).

    the generalized accumulative matrix (combining transition probabilities, emission probabilities and observations). If only multiplication is used, set this to provide the initial state (see above), followed either by zeroes or by terminating the signal.

  5. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  6. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  7. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  8. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  9. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  10. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  11. def makeUGen(args: IndexedSeq[UGenIn])(implicit b: Builder): UGenInLike

    Permalink
    Attributes
    protected
    Definition Classes
    ViterbiUGenSource
  12. def makeUGens(implicit b: Builder): UGenInLike

    Permalink

    Abstract method which must be implemented by creating the actual UGens during expansion.

    Abstract method which must be implemented by creating the actual UGens during expansion. This method is at most called once during graph expansion

    returns

    the expanded object (depending on the type parameter U)

    Attributes
    protected
    Definition Classes
    ViterbiExpander
  13. val mul: GE

    Permalink

    the generalized multiplicative matrix (combining transition probabilities, emission probabilities and observations).

    the generalized multiplicative matrix (combining transition probabilities, emission probabilities and observations). If only accumulation is used, set this to 1.0.

  14. final def name: String

    Permalink
    Definition Classes
    UGenSource
  15. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  16. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  17. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  18. val numFrames: GE

    Permalink

    the number of observations.

    the number of observations. If -1, the UGen runs until the input is exhausted. This happens when both mul and add end. see StrongestLocalMaxima see PitchesToViterbi

  19. val numStates: GE

    Permalink

    the number of different states, as reflected by the inner dimensions of matrices mul and add.

  20. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  21. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  22. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  23. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from Serializable

Inherited from Serializable

Inherited from SingleOut

Inherited from SomeOut[StreamOut]

Inherited from GE.Lazy

Inherited from GE

Inherited from UGenSource[UGenInLike, StreamOut]

Inherited from Expander[UGenInLike]

Inherited from Lazy

Inherited from Product

Inherited from Equals

Inherited from AnyRef

Inherited from Any

Ungrouped