# tslearn.metrics¶

The `tslearn.metrics`

module delivers time-series specific metrics to be
used at the core of machine learning algorithms.

**User guide:** See the Dynamic Time Warping (DTW) section for
further details.

Functions

`cdist_dtw` (dataset1[, dataset2, …]) |
Compute cross-similarity matrix using Dynamic Time Warping (DTW) similarity measure. |

`cdist_gak` (dataset1[, dataset2, sigma, …]) |
Compute cross-similarity matrix using Global Alignment kernel (GAK). |

`dtw` (s1, s2[, global_constraint, …]) |
Compute Dynamic Time Warping (DTW) similarity measure between (possibly multidimensional) time series and return it. |

`dtw_path` (s1, s2[, global_constraint, …]) |
Compute Dynamic Time Warping (DTW) similarity measure between (possibly multidimensional) time series and return both the path and the similarity. |

`dtw_path_from_metric` (s1[, s2, metric, …]) |
Compute Dynamic Time Warping (DTW) similarity measure between (possibly multidimensional) time series using a distance metric defined by the user and return both the path and the similarity. |

`dtw_limited_warping_length` (s1, s2, max_length) |
Compute Dynamic Time Warping (DTW) similarity measure between (possibly multidimensional) time series under an upper bound constraint on the resulting path length and return the similarity cost. |

`dtw_path_limited_warping_length` (s1, s2, …) |
Compute Dynamic Time Warping (DTW) similarity measure between (possibly multidimensional) time series under an upper bound constraint on the resulting path length and return the path as well as the similarity cost. |

`subsequence_path` (acc_cost_mat, idx_path_end) |
Compute the optimal path through a accumulated cost matrix given the endpoint of the sequence. |

`subsequence_cost_matrix` (subseq, longseq) |
Compute the accumulated cost matrix score between a subsequence and a reference time series. |

`dtw_subsequence_path` (subseq, longseq) |
Compute sub-sequence Dynamic Time Warping (DTW) similarity measure between a (possibly multidimensional) query and a long time series and return both the path and the similarity. |

`gak` (s1, s2[, sigma]) |
Compute Global Alignment Kernel (GAK) between (possibly multidimensional) time series and return it. |

`soft_dtw` (ts1, ts2[, gamma]) |
Compute Soft-DTW metric between two time series. |

`cdist_soft_dtw` (dataset1[, dataset2, gamma]) |
Compute cross-similarity matrix using Soft-DTW metric. |

`cdist_soft_dtw_normalized` (dataset1[, …]) |
Compute cross-similarity matrix using a normalized version of the Soft-DTW metric. |

`lb_envelope` (ts[, radius]) |
Compute time-series envelope as required by LB_Keogh. |

`lb_keogh` (ts_query[, ts_candidate, radius, …]) |
Compute LB_Keogh. |

`sigma_gak` (dataset[, n_samples, random_state]) |
Compute sigma value to be used for GAK. |

`gamma_soft_dtw` (dataset[, n_samples, …]) |
Compute gamma value to be used for GAK/Soft-DTW. |