1.0 - 8.00 - SAX Example 2: Sliding Window, Default Output - Teradata Vantage

Teradata® Vantage Machine Learning Engine Analytic Function Reference

Product
Teradata Vantage
Release Number
1.0
8.00
Release Date
May 2019
Content Type
Programming Reference
Publication ID
B700-4003-098K
Language
English (United States)

Input

SQL Call

SELECT
    id,
    period_start,
    period_end,
    cast (expenditure_saxcode AS VARBYTE(50)) AS expenditure_saxcode,
    expenditure_mean,
    expenditure_stdev
FROM SAX (
  ON finance_data3 AS "input" PARTITION BY id ORDER BY period
  USING
    TargetColumns ('expenditure')
    TimeColumn ('period')
    WindowType ('sliding')
    WindowSize (20)
    OutputStats ('true')
    Accumulate ('id')
) AS dt ORDER BY 1;

Output

id period_start period_end expenditure_saxcode expenditure_mean expenditure_stdev
1 1960Q1 1964Q4 6161616161616262626363636363646464646464 507.65 56.4654295728117
1 1960Q2 1965Q1 6161616161616262626263636363636464646464 517.75 57.0833877576897
1 1960Q3 1965Q2 6161616161616262626263636363646464646464 528.65 58.4341960084844
1 1960Q4 1965Q3 6161616161616262626262636363636464646464 539.6 60.255071854662
1 1961Q1 1965Q4 6161616161626262626262636363636464646464 550.6 62.6850103798008
1 1961Q2 1966Q1 6161616161616262626262636363636464646464 561.6 65.0242060191514
1 1961Q3 1966Q2 6161616161616262626263636363636464646464 573 65.8858662265366
1 1961Q4 1966Q3 6161616161616162626262636363646464646464 583.9 67.5284735266697
1 1962Q1 1966Q4 6161616161616162626262636363646464646464 593.95 67.3048641395409
... ... ... ... ... ...