ChangePointDetection Example | Teradata Vantage - ChangePointDetection Example: Two Series, Default Options - Teradata Vantage

Machine Learning Engine Analytic Function Reference

Product
Teradata Vantage
Release Number
9.02
9.01
2.0
1.3
Published
February 2022
Language
English (United States)
Last Update
2022-02-10
dita:mapPath
rnn1580259159235.ditamap
dita:ditavalPath
ybt1582220416951.ditaval
dita:id
B700-4003
lifecycle
previous
Product Category
Teradata Vantageā„¢

Input

Input table finance_data2 contains two time series of finance data.

finance_data2
sid id start_time_column end_time_column expenditure income investment
1 1 1967-06-30 2007-03-31 415 451 180
1 2 1967-06-30 2007-03-31 421 465 179
1 3 1967-06-30 2007-03-31 434 485 185
1 4 1967-06-30 2007-03-31 448 493 192
1 5 1967-06-30 2007-03-31 459 509 211
1 6 1967-06-30 2007-03-31 458 520 202
1 7 1967-06-30 2007-03-31 479 521 207
1 8 1967-06-30 2007-03-31 487 540 214
1 9 1967-06-30 2007-03-31 497 548 231
1 10 1967-06-30 2007-03-31 510 558 229
1 11 1967-06-30 2007-03-31 516 574 234
1 12 1967-06-30 2007-03-31 525 583 237
1 13 1967-06-30 2007-03-31 529 591 206
1 14 1967-06-30 2007-03-31 538 599 250
1 15 1967-06-30 2007-03-31 546 610 259
... ... ... ... ... ... ...

SQL Call

SELECT * FROM ChangePointDetection (
  ON finance_data2 PARTITION BY sid ORDER BY id
  USING
  TargetColumn ('expenditure')
  Accumulate ('sid', 'id', 'expenditure')
) AS dt;

Output

 sid id expenditure cptid 
 --- -- ----------- ----- 
   1  3       434.0     1
   1  5       459.0     2
   1  7       479.0     3
   1 10       510.0     4

Download a zip file of all examples and a SQL script file that creates their input tables.