tslearn.metrics.gamma_soft_dtw

tslearn.metrics.gamma_soft_dtw(dataset, n_samples=100, random_state=None)[source]

Compute gamma value to be used for GAK/Soft-DTW.

This method was originally presented in [1].

Parameters:
dataset

A dataset of time series

n_samples : int (default: 100)

Number of samples on which median distance should be estimated

random_state : integer or numpy.RandomState or None (default: None)

The generator used to draw the samples. If an integer is given, it fixes the seed. Defaults to the global numpy random number generator.

Returns:
float

Suggested \(\gamma\) parameter for the Soft-DTW

See also

sigma_gak
Compute sigma parameter for Global Alignment kernel

References

[1]
  1. Cuturi, “Fast global alignment kernels,” ICML 2011.

Examples

>>> dataset = [[1, 2, 2, 3], [1., 2., 3., 4.]]
>>> gamma_soft_dtw(dataset=dataset,
...                n_samples=200,
...                random_state=0)  # doctest: +ELLIPSIS
8.0...