Time Series Search (TSS)

This page describes the Time Series Search (TSS) parameters as part of AI libs.

.ai.tss.tss

The .ai.tss.tss function conducts a TSS search with z-normalization and returns k nearest neighbors.

Parameters

Name

Type(s)

Description

ts

short[] | int[] | long[] | float[] | real[]

The data vector

q

short[] | int[] | long[] | float[] | real[]

The query vector

k

short | long | int

The number of nearest neighbors to return

opts

dict

Advanced options (optional):

  • ignoreErrors (default false): if true, allows k > count[ts] (k set to count[ts]) and q longer than ts (returns empty).

  • returnMatches (default false): if true, returns a list of distances, indexes, and matched patterns.

  • normalize (default true): if true, applies z-normalization to query and timeseries windows.

Returns

Type

Description

(float[]; long[])

List of distances and indexes

Example

q

Copy
q)\l ai-libs/init.q
q).ai.tss.tss[10?1f;3?1f;5;::]

0.9182925 0.9312366 1.44556 2.310831 2.842262
2         6         1       4        7

.ai.tss.tssdist

The .ai.tss.tssdist function creates a list of sliding z-normalized distances.

Parameters

Name

Type(s)

Description

ts

short[] | int[] | long[] | float[] | real[]

The data vector

q

short[] | int[] | long[] | float[] | real[]

The query vector

opts

dict

Advanced options (optional):

normalize (default true): if true, applies z-normalization to query and timeseries windows.

Returns

Type

Description

float[]

The TSS distances among all possible positions

Example

q

Copy
q)\l ai-libs/init.q
q).ai.tss.tssdist[10?1f;3?1f;::]

0.1624568 0.6407308 0.9527249 0.8994361 0.6351341 0.8521289 0.9975543 0.8938303