diff --git a/tslearn/docs/dtw.rst b/tslearn/docs/dtw.rst index 444e55782..471a56758 100644 --- a/tslearn/docs/dtw.rst +++ b/tslearn/docs/dtw.rst @@ -114,6 +114,14 @@ as illustrated below: :math:`n = m = 10, r = 3`. Diagonal is marked in grey for better readability. +The corresponding code would be: + +.. code-block:: python + + from tslearn.metrics import dtw + cost = dtw(x, y, global_constraint="sakoe_chiba", sakoe_chiba_radius=3) + + Second, the Itakura parallelogram sets a maximum slope :math:`s` for alignment paths, which leads to a parallelogram-shaped constraint: @@ -124,6 +132,14 @@ paths, which leads to a parallelogram-shaped constraint: :math:`n = m = 10, s = 2`. Diagonal is marked in grey for better readability. +The corresponding code would be: + +.. code-block:: python + + from tslearn.metrics import dtw + cost = dtw(x, y, global_constraint="itakura", itakura_max_slope=2.) + + Alternatively, one can put an upper bound on the warping path length so as to discard complex paths, as described in [2]_: diff --git a/tslearn/docs/variablelength.rst b/tslearn/docs/variablelength.rst index 52eb61144..c604e98f3 100644 --- a/tslearn/docs/variablelength.rst +++ b/tslearn/docs/variablelength.rst @@ -1,5 +1,5 @@ -Methods for variable-length time series datasets -================================================ +Methods for variable-length time series +======================================= This page lists machine learning methods in `tslearn` that are able to deal with datasets containing time series of different lengths.