# 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). |

`ctw` (s1, s2[, max_iter, n_components, …]) |
Compute Canonical Time Warping (CTW) similarity measure between (possibly multidimensional) time series and return the similarity. |

`ctw_path` (s1, s2[, max_iter, n_components, …]) |
Compute Canonical Time Warping (CTW) similarity measure between (possibly multidimensional) time series and return the alignment path, the canonical correlation analysis (sklearn) object and the similarity. |

`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. |

`lcss` (s1, s2[, eps, global_constraint, …]) |
Compute the Longest Common Subsequence (LCSS) similarity measure between (possibly multidimensional) time series and return the similarity. |

`lcss_path` (s1, s2[, eps, global_constraint, …]) |
Compute the Longest Common Subsequence (LCSS) similarity measure between (possibly multidimensional) time series and return both the path and the similarity. |

`lcss_path_from_metric` (s1[, s2, eps, metric, …]) |
Compute the Longest Common Subsequence (LCSS) similarity measure between (possibly multidimensional) time series using a distance metric defined by the user 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. |

`soft_dtw_alignment` (ts1, ts2[, gamma]) |
Compute Soft-DTW metric between two time series and return both the similarity measure and the alignment matrix. |

`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. |