fintech-algorithms
Using a coding agent? Give it the skill: npx skills add IslamBaraka90/Fintech-Algorithms-Library What it does →

Dynamic-Time-Warping Pattern Match

Install and import#

bash
npm install fintech-algorithms
ts
import { 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#

argument 1
[0, 0.5, 1.6, 3.2, 5, 6.1]

Showing 6 of 16 elements.

argument 2
[0, 0.2, 0.7, 1.5, 2.7, 4.2]

Showing 6 of 20 elements.

argument 3
5

Call#

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#

Dynamic-Time-Warping Pattern Match — algorithm anatomy
Dynamic-Time-Warping Pattern Match — article hero
Dynamic-Time-Warping Pattern Match — calculation ledger
Dynamic-Time-Warping Pattern Match — causal timeline
Dynamic-Time-Warping Pattern Match — failure boundary
Dynamic-Time-Warping Pattern Match — method comparison

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.

Read the article →

References#

The rest of the Pattern Matching family#