marytts.util.math

## Class DTW

• public class DTW
extends Object
Dynamic programming to compute similarity measure
Author:
sathish
• ### Nested Class Summary

Nested Classes
Modifier and Type Class and Description
class  DTW.Node
• ### Constructor Summary

Constructors
Constructor and Description
DTW(double[][] signal, double[][] reference)
Dynamic time warping (DTW) cost signal and reference Default 'Euclidean' distance function
DTW(double[][] signal, double[][] reference, double[] sigma2)
DTW using Mahalanobis distance (Variance computation from external module)
DTW(double[][] signal, double[][] reference, String distanceFunction)
Dynamic time warping (DTW) cost signal and reference distanceFunction = {"Euclidean" or "Absolute"}
• ### Constructor Detail

• #### DTW

public DTW(double[][] signal,
double[][] reference)
Dynamic time warping (DTW) cost signal and reference Default 'Euclidean' distance function
Parameters:
signal - signal
reference - reference
• #### DTW

public DTW(double[][] signal,
double[][] reference,
String distanceFunction)
Dynamic time warping (DTW) cost signal and reference distanceFunction = {"Euclidean" or "Absolute"}
Parameters:
signal - signal
reference - reference
distanceFunction - distance function
• #### DTW

public DTW(double[][] signal,
double[][] reference,
double[] sigma2)
DTW using Mahalanobis distance (Variance computation from external module)
Parameters:
signal - signal
reference - reference
sigma2 - sigma2
• ### Method Detail

• #### getCost

public double getCost()
Get cost of best path
Returns:
cost
• #### getNormalizedCost

public double getNormalizedCost()
Get cost of best path
Returns:
cost
• #### EuclideanDistance

public double EuclideanDistance(double[] x,
double[] y)
Euclidean distance
Parameters:
x - x
y - y
Returns:
sum
• #### AbsDistance

public double AbsDistance(double[] x,
double[] y)
Absolute distance
Parameters:
x - x
y - y
Returns:
sum
• #### weightFunction

public double[] weightFunction(int windowLength)
• #### frameDistance

protected double frameDistance(double[] f1,
double[] f2,
String distanceType)