# tslearn.metrics.cdist_gak¶

tslearn.metrics.cdist_gak(dataset1, dataset2=None, sigma=1.0, n_jobs=None, verbose=0)[source]

Compute cross-similarity matrix using Global Alignment kernel (GAK).

GAK was originally presented in [1].

Parameters: dataset1 A dataset of time series dataset2 Another dataset of time series sigma : float (default 1.) Bandwidth of the internal gaussian kernel used for GAK n_jobs : int or None, optional (default=None) The number of jobs to run in parallel. None means 1 unless in a joblib.parallel_backend context. -1 means using all processors. See scikit-learns’ Glossary for more details. verbose : int, optional (default=0) The verbosity level: if non zero, progress messages are printed. Above 50, the output is sent to stdout. The frequency of the messages increases with the verbosity level. If it more than 10, all iterations are reported. Glossary for more details. numpy.ndarray Cross-similarity matrix

gak
Compute Global Alignment kernel

References

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

Examples

>>> cdist_gak([[1, 2, 2, 3], [1., 2., 3., 4.]], sigma=2.)
array([[1.        , 0.65629661],
[0.65629661, 1.        ]])
>>> cdist_gak([[1, 2, 2], [1., 2., 3., 4.]],
...           [[1, 2, 2, 3], [1., 2., 3., 4.], [1, 2, 2, 3]],
...           sigma=2.)
array([[0.71059484, 0.29722877, 0.71059484],
[0.65629661, 1.        , 0.65629661]])