1.0 - 8.00 - ShapeletSupervised Example - 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

The input table has 10 price observations for four stocks. The column period contains time values, represented by integers.

InputTable: shapelets_train
stockid period stockprice stock_category
1 22418 460 Technology
1 22419 457 Technology
1 22420 452 Technology
1 22421 459 Technology
1 22422 462 Technology
1 22423 459 Technology
1 22424 463 Technology
1 22425 479 Technology
1 22426 493 Technology
1 22427 490 Technology
2 22418 492 Technology
2 22419 498 Technology
2 22420 499 Technology
2 22421 497 Technology
2 22422 496 Technology
2 22423 490 Technology
2 22424 489 Technology
2 22425 478 Technology
2 22426 487 Technology
2 22427 491 Technology
3 22418 68.2502 Healthcare
3 22419 67.7501 Healthcare
3 22420 68.375 Healthcare
3 22421 67.1251 Healthcare
3 22422 67.1251 Healthcare
3 22423 66 Healthcare
3 22424 66.5002 Healthcare
3 22425 64.1251 Healthcare
3 22426 64.7501 Healthcare
3 22427 65.375 Healthcare
4 22418 66.625 Healthcare
4 22419 66.8746 Healthcare
4 22420 67.0003 Healthcare
4 22421 67.2499 Healthcare
4 22422 65.8752 Healthcare
4 22423 66.1248 Healthcare
4 22424 66.5002 Healthcare
4 22425 67.7501 Healthcare
4 22426 67.4995 Healthcare
4 22427 67.2499 Healthcare

SQL Call

SELECT * FROM ShapeletSupervised (
  ON shapelets_train AS InputTable
  OUT TABLE ModelTable (shapelets_model)
  USING
  IDColumn ('id')
  TimeColumn ('period')
  TargetColumn ('stockprice')
  CategoryColumn ('stock_category')
  SaxMinWindowSize (3)
  SaxMaxWindowSize (6)
  SaxOutputFrequency (1)
  SaxSymbolsPerWindow (3)
  RandomProjections (10)
  TimeInterval (1)
) AS dt;

Output

stats
shapelet model table created.
number of shapelets : 1
number of rows : 6

This query returns the following table:

SELECT * FROM shapelets_model ORDER BY 1, 2;
shapelets_model
shapelet_id time_instant value split_value left_child_id right_child_id left_class right_class
1 1 67.1251 1.21809 0 0 Healthcare Technology
1 2 66 1.21809 0 0 Healthcare Technology
1 3 66.5002 1.21809 0 0 Healthcare Technology
1 4 64.1251 1.21809 0 0 Healthcare Technology
1 5 64.7501 1.21809 0 0 Healthcare Technology
1 6 65.375 1.21809 0 0 Healthcare Technology