TD_IQR Examples | Anomaly Detection | Teradata Vantage - TD_IQR Examples - Teradata Vantage

Database Unbounded Array Framework Time Series Functions

Deployment
VantageCloud
VantageCore
Edition
Enterprise
IntelliFlex
VMware
Product
Teradata Vantage
Release Number
17.20
Published
June 2022
Language
English (United States)
Last Update
2024-10-04
dita:mapPath
ncd1634149624743.ditamap
dita:ditavalPath
ruu1634160136230.ditaval
dita:id
ncd1634149624743

Example: TD_IQR Call for Primary Layer

EXECUTE FUNCTION
INTO VOLATILE ART(RESULTS)
TD_IQR(
  SERIES_SPEC(
    TABLE_NAME(REAL_VALUES),
    ROW_AXIS( TIMECODE(TD_TIMECODE) ),
    SERIES_ID(ID),
    PAYLOAD( FIELDS(VAL) , CONTENT(REAL) )
    ),
  FUNC_PARAMS( STAT_METRICS(1) )
);

TD_IQR Output for Primary Layer

SELECT * FROM RESULTS;
ID   ROW_I VAL                     VAL_Anomaly

33   0     1.20000000000000E 002   1
33   1     1.44000000000000E 002   1
33   2     2.20000000000000E 002   1
33   3     8.00000000000000E 002   -1
33   4     1.84000000000000E 002   1
33   5     3.20000000000000E 002   1
33   6     6.60000000000000E 001   1
33   7     1.44000000000000E 002   1
33   8     1.95000000000000E 002   1
33   9     1.34000000000000E 002   1
33   10    1.98000000000000E 002   1
33   11    2.10000000000000E 002   1
33   12    2.10000000000000E 004   -1

Call for Secondary Layer

EXECUTE FUNCTION
INTO ART(res)
TD_EXTRACT_RESULTS(
  ART_SPEC(
    TABLE_NAME(RESULTS),
    LAYER(ARTSTATSDATA)
  )
);

TD_IQR Output for Secondary Layer

SELECT * FROM res;
ID    ROW_I    VAL_NUM_OUTLIERS

33    0        2