Skip to content

Commit

Permalink
Updated docs (added examples for constrained DTW)
Browse files Browse the repository at this point in the history
  • Loading branch information
rtavenar committed Jan 24, 2020
1 parent b85bee1 commit 7ab6b9d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
16 changes: 16 additions & 0 deletions tslearn/docs/dtw.rst
Expand Up @@ -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:
Expand All @@ -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]_:
Expand Down
4 changes: 2 additions & 2 deletions 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.
Expand Down

0 comments on commit 7ab6b9d

Please sign in to comment.