WOLFRAM

gives the time warping (DTW) similarity path between sequences s1 and s2.

uses a window specified by win for local search.

Details and Options

Examples

open allclose all

Basic Examples  (1)Summary of the most common use cases

Find the time warping correspondence between two sequences:

Out[3]=3

Plot the correspondence between indices:

Out[4]=4

Find the time warped versions:

Out[5]=5
Out[6]=6

The warped versions are approximately equal:

Out[7]=7

Scope  (9)Survey of the scope of standard use cases

Data  (6)

Find the time warping correspondence between two real-valued vectors:

Out[1]=1

Find the time warping correspondence between two sequences of vectors:

Out[2]=2

Find the time warping correspondence between two Boolean vectors:

Out[1]=1
Out[2]=2
Out[3]=3

Sequences of Boolean-valued vectors:

Out[2]=2

Sequences of quantities with compatible units:

Out[2]=2

Two-dimensional quantity arrays:

Out[1]=1
Out[2]=2
Out[3]=3

Search Window  (3)

By default, the search is not locally constrained:

Out[18]=18
Out[19]=19

Specify a radius for the search window:

Out[20]=20

A search radius of 2 allows you to find the optimal alignment:

Out[21]=21

Use a band of radius 1:

Out[2]=2

Use a parallelogram of slope 3:

Out[3]=3

For signals of equal length, the "Band" window is equivalent to the "SlantedBand" window:

Out[2]=2

Options  (4)Common values & functionality for each option

DistanceFunction  (3)

With Boolean sequences, WarpingCorrespondence uses MatchingDissimilarity:

Out[3]=3
Out[4]=4

Find correspondences between two sequences using different distance functions:

Out[2]=2

In case of one-dimensional signals, some distance functions are equivalent:

Euclidean, Manhattan, and the chessboard distance are always the same:

Out[2]=2

Normalized Euclidean distance and correlation distance are the same:

Out[3]=3

For Boolean data, matching dissimilarity and binary distance are the same:

Out[5]=5

Method  (1)

Compare the result of full search to a flexible search:

Out[3]=3
Out[4]=4

Visually compare the results:

Out[5]=5

Applications  (2)Sample problems that can be solved with this function

Visualize the time warping correspondence by drawing lines between corresponding points:

Apply it to some data:

Out[3]=3
Out[4]=4

Compare the first quarter of 2017 of the HPQ stock prices with historical data from 2010 to 2016:

Get historic data:

Find the best matching subsequence of historical data:

Detect the historical interval most similar to quarter one of 2017:

Out[4]=4

Visually compare recent data and the best historical match:

Out[5]=5

Predict the stock prices for the next 30 days based on historical data:

Out[6]=6

Properties & Relations  (7)Properties of the function, and connections to other functions

The two sequences need not have the same length:

Out[1]=1

The warping path of two equal sequences goes along a diagonal line:

Out[1]=1

Smaller values of the search window radius emphasize speed of computation:

Out[2]=2
Out[3]=3

There may be a tradeoff with quality of the computation:

Out[4]=4

When computing the full correspondence, WarpingCorrespondence is symmetric:

Out[1]=1

The function is not symmetric when matching subsequences:

Out[2]=2

Adding to or subtracting from values of one sequence may result in a different correspondence:

Out[1]=1

Adding to or subtracting from both sequences will not affect the result when distance function is induced by a norm (translation invariant):

This is true for Euclidean, Manhattan, and some more:

Out[2]=2

Using distance functions that are not translation invariant may produce different correspondence:

Out[3]=3

Relation with WarpingDistance:

Find the time warped sequences using the correspondence:

WarpingDistance gives the sum of all the distances between corresponding elements:

Out[4]=4

Possible Issues  (3)Common pitfalls and unexpected behavior

All elements in the two sequences must be commensurate:

Out[1]=1

Elements in the two sequences should be of the same type:

Out[1]=1

If the specified window is too narrow to find a correspondence, a larger window is automatically used:

Out[1]=1
Wolfram Research (2016), WarpingCorrespondence, Wolfram Language function, https://reference.wolfram.com/language/ref/WarpingCorrespondence.html.
Wolfram Research (2016), WarpingCorrespondence, Wolfram Language function, https://reference.wolfram.com/language/ref/WarpingCorrespondence.html.

Text

Wolfram Research (2016), WarpingCorrespondence, Wolfram Language function, https://reference.wolfram.com/language/ref/WarpingCorrespondence.html.

Wolfram Research (2016), WarpingCorrespondence, Wolfram Language function, https://reference.wolfram.com/language/ref/WarpingCorrespondence.html.

CMS

Wolfram Language. 2016. "WarpingCorrespondence." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/WarpingCorrespondence.html.

Wolfram Language. 2016. "WarpingCorrespondence." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/WarpingCorrespondence.html.

APA

Wolfram Language. (2016). WarpingCorrespondence. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/WarpingCorrespondence.html

Wolfram Language. (2016). WarpingCorrespondence. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/WarpingCorrespondence.html

BibTeX

@misc{reference.wolfram_2025_warpingcorrespondence, author="Wolfram Research", title="{WarpingCorrespondence}", year="2016", howpublished="\url{https://reference.wolfram.com/language/ref/WarpingCorrespondence.html}", note=[Accessed: 21-May-2025 ]}

@misc{reference.wolfram_2025_warpingcorrespondence, author="Wolfram Research", title="{WarpingCorrespondence}", year="2016", howpublished="\url{https://reference.wolfram.com/language/ref/WarpingCorrespondence.html}", note=[Accessed: 21-May-2025 ]}

BibLaTeX

@online{reference.wolfram_2025_warpingcorrespondence, organization={Wolfram Research}, title={WarpingCorrespondence}, year={2016}, url={https://reference.wolfram.com/language/ref/WarpingCorrespondence.html}, note=[Accessed: 21-May-2025 ]}

@online{reference.wolfram_2025_warpingcorrespondence, organization={Wolfram Research}, title={WarpingCorrespondence}, year={2016}, url={https://reference.wolfram.com/language/ref/WarpingCorrespondence.html}, note=[Accessed: 21-May-2025 ]}