Dynamic Time Warping (DTW)
This page describes the parameters for the Dynamic Time Warping (DTW) algorithm as part of AI libs.
.ai.dtw.filterSearch
The .ai.dtw.filterSearch function returns the k best matches for q from ts under cutoff distance.
Parameters
|
Name |
Type(s) |
Description |
|---|---|---|
|
|
float[] |
The timeseries |
|
|
float[] |
The pattern to search for |
|
|
short | int | long |
The number of best matches to return |
|
|
short | int | long | real | float |
The ratio of query size allowed in warping |
|
|
short | int | long | real | float |
The maximum distance (exclusive) |
|
|
dict |
Advanced options (optional):
|
Returns
|
Type |
Description |
|---|---|
|
(float[]; long[]) |
A list of distances and ids for nearest matches |
Example
q
q).ai:use`kx.ai
q)ts: neg[5.0] + 1000?10.0;
q)q:neg[5.0] + 10?10.0;
q).ai.dtw.filterSearch[ts;q;4;0.3;1.4;::]
1.336535 1.376232 1.39632
492 848 875
.ai.dtw.search
The .ai.dtw.search function returns k best matches for q from ts.
Parameters
|
Name |
Type(s) |
Description |
|---|---|---|
|
|
float[] |
The timeseries to search on |
|
|
float[] |
The pattern to search for |
|
|
short | int | long |
The number of best matches to return |
|
|
short | int | long | real | float |
The ratio of query size allowed in warping |
|
|
dict |
Advanced options (optional):
|
Returns
|
Type |
Description |
|---|---|
|
(float[]; long[]) |
A list of distances and ids for nearest matches |
Example
q
q).ai:use`kx.ai
q)ts: neg[5.0] + 1000?10.0;
q)q:neg[5.0] + 10?10.0;
q).ai.dtw.search[ts;q;4;0.3;::]
1.336535 1.376232 1.39632 1.41458
492 848 875 295
.ai.dtw.searchRange
The .ai.dtw.searchRange function returns the best matches for q from ts under cutoff distance.
Parameters
|
Name |
Type(s) |
Description |
|---|---|---|
|
|
float[] |
The timeseries to search on |
|
|
float[] |
The pattern to search for |
|
|
short | int | long | real | float |
The ratio of query size allowed in warping |
|
|
short | int | long| real | float |
The maximum distance (exclusive) |
|
|
dict |
Advanced options (optional):
|
Returns
|
Type |
Description |
|---|---|
|
(float[]; long[]) |
A list of distances and ids for nearest matches |
Example
q
q).ai:use`kx.ai
q)ts: neg[5.0] + 1000?10.0;
q)q:neg[5.0] + 10?10.0;
q).ai.dtw.searchRange[ts;q;0.3;1.4;::]
1.336535 1.376232 1.39632
492 848 875