WarpingCorrespondence

WarpingCorrespondence[s1,s2]

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

WarpingCorrespondence[s1,s2,win]

uses a window specified by win for local search.

Details and Options

Examples

open allclose all

Basic Examples  (1)

Find the time warping correspondence between two sequences:

Plot the correspondence between indices:

Find the time warped versions:

The warped versions are approximately equal:

Scope  (9)

Data  (6)

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

Find the time warping correspondence between two sequences of vectors:

Find the time warping correspondence between two Boolean vectors:

Sequences of Boolean-valued vectors:

Sequences of quantities with compatible units:

Two-dimensional quantity arrays:

Search Window  (3)

By default, the search is not locally constrained:

Specify a radius for the search window:

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

Use a band of radius 1:

Use a parallelogram of slope 3:

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

Options  (4)

DistanceFunction  (3)

With Boolean sequences, WarpingCorrespondence uses MatchingDissimilarity:

Find correspondences between two sequences using different distance functions:

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

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

Normalized Euclidean distance and correlation distance are the same:

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

Method  (1)

Compare the result of full search to a flexible search:

Visually compare the results:

Applications  (2)

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

Apply it to some data:

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:

Visually compare recent data and the best historical match:

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

Properties & Relations  (7)

The two sequences need not have the same length:

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

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

There may be a tradeoff with quality of the computation:

When computing the full correspondence, WarpingCorrespondence is symmetric:

The function is not symmetric when matching subsequences:

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

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:

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

Relation with WarpingDistance:

Find the time warped sequences using the correspondence:

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

Possible Issues  (3)

All elements in the two sequences must be commensurate:

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

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

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.

CMS

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

BibTeX

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

BibLaTeX

@online{reference.wolfram_2023_warpingcorrespondence, organization={Wolfram Research}, title={WarpingCorrespondence}, year={2016}, url={https://reference.wolfram.com/language/ref/WarpingCorrespondence.html}, note=[Accessed: 28-March-2024 ]}