tslearn.metrics.cdist_soft_dtw¶

tslearn.metrics.
cdist_soft_dtw
(dataset1, dataset2=None, gamma=1.0)[source]¶ Compute crosssimilarity matrix using SoftDTW metric.
SoftDTW was originally presented in [1] and is discussed in more details in our userguide page on DTW and its variants.
SoftDTW is computed as:
\[\text{softDTW}_{\gamma}(X, Y) = \min_{\pi}{}^\gamma \sum_{(i, j) \in \pi} \X_i, Y_j\^2\]where \(\min^\gamma\) is the softmin operator of parameter \(\gamma\).
In the limit case \(\gamma = 0\), \(\min^\gamma\) reduces to a hardmin operator and softDTW is defined as the square of the DTW similarity measure.
Parameters:  dataset1
A dataset of time series
 dataset2
Another dataset of time series
 gamma : float (default 1.)
Gamma paraneter for SoftDTW
Returns:  numpy.ndarray
Crosssimilarity matrix
See also
soft_dtw
 Compute SoftDTW
cdist_soft_dtw_normalized
 Cross similarity matrix between time series datasets using a normalized version of SoftDTW
References
[1] M. Cuturi, M. Blondel “SoftDTW: a Differentiable Loss Function for TimeSeries,” ICML 2017. Examples
>>> cdist_soft_dtw([[1, 2, 2, 3], [1., 2., 3., 4.]], gamma=.01) array([[0.01098612, 1. ], [ 1. , 0. ]]) >>> cdist_soft_dtw([[1, 2, 2, 3], [1., 2., 3., 4.]], ... [[1, 2, 2, 3], [1., 2., 3., 4.]], gamma=.01) array([[0.01098612, 1. ], [ 1. , 0. ]])