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

Machine Learning Engine Analytic Function Reference

Product
Teradata Vantage
Release Number
8.00
1.0
Published
May 2019
Language
English (United States)
Last Update
2019-11-22
dita:mapPath
blj1506016597986.ditamap
dita:ditavalPath
blj1506016597986.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
  ValueColumn ('expenditure')
  Accumulate ('sid', 'id', 'expenditure')
) AS dt ORDER BY sid, id;

Output

sid id expenditure cptid
1 3 434 1
1 5 459 2
1 7 479 3
1 10 510 4
1 12 525 5
1 14 538 6
1 17 574 7
1 19 586 8
1 22 639 9
1 25 679 10
2 34 746 1
2 37 1774 2
2 42 1958 3
2 44 1994 4
2 47 2102 5
2 49 798 6
2 52 858 7
2 55 934 8
2 58 1013 9