Dynamic-Time-Warping Pattern Match
Install and import#
npm install fintech-algorithmsimport { match } from "fintech-algorithms/geometric-chart-patterns/pattern-matching/dynamic-time-warping-pattern-match";Signature#
match()Worked example#
executed This entry is a thin wrapper its test never calls directly, so it was invoked with the arguments its shared implementation received. Real output, not asserted against a published figure.
Input#
[0, 0.5, 1.6, 3.2, 5, 6.1]Showing 6 of 16 elements.
[0, 0.2, 0.7, 1.5, 2.7, 4.2]Showing 6 of 20 elements.
5Call#
match()Returns#
object with 7 fields: distance, path_rms, path_length, path, radius, normalized, cost_matrix
{
"distance": 0.8828777062798496,
"path_rms": 0.19265971040078095,
"path_length": 21,
"path": [
[0, 0],
[1, 1],
[1, 2]
],
"radius": 5,
"normalized": true,
"cost_matrix": [
[
0.005392023895877613,
0.036191498358618325,
0.22166492791858747,
0.9254782337120473,
3.0318664648048,
7.946270727248203
],
[
0.03942879310652065,
0.012185604161087042,
0.04202654074278329,
0.3796047955087834,
1.8038541385002964,
5.641239716500235
],
[
0.6048075127728977,
0.4344897279549777,
0.16795856695383304,
0.04221119401162229,
0.4340784939436583,
2.370346476931225
]
]
}Diagrams#
How it works#
This page states the contract — how to call it correctly. The article explains the concept: why it works, and where it breaks.
References#
- Foundations of Technical Analysis — Andrew W. Lo, Harry Mamaysky, and Jiang Wang
- SciPy `find_peaks` — SciPy project
- The Probability of Backtest Overfitting — David H. Bailey, Jonathan M. Borwein, Marcos López de Prado, and Qiji Jim Zhu
- Dynamic Programming Algorithm Optimization for Spoken Word Recognition — Hiroaki Sakoe and Seibi Chiba
- Applicability decision