1.1 - 8.10 - ShapeletSupervised Example - Teradata Vantage

Teradata Vantage™ - Machine Learning Engine Analytic Function Reference

Product
Teradata Vantage
Release Number
1.1
8.10
Release Date
October 2019
Content Type
Programming Reference
Publication ID
B700-4003-079K
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')
  ResponseColumn ('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
SELECT * FROM shapelets_model;
 shapelet_id time_instant value_col split_value        left_child_id right_child_id left_class right_class 
 ----------- ------------ --------- ------------------ ------------- -------------- ---------- ----------- 
           1            1  67.12512 1.2180900573730469             0              0 healthcare technology 
           1            2      66.0 1.2180900573730469             0              0 healthcare technology 
           1            3 66.500158 1.2180900573730469             0              0 healthcare technology 
           1            4  64.12512 1.2180900573730469             0              0 healthcare technology 
           1            5 64.750082 1.2180900573730469             0              0 healthcare technology 
           1            6 65.375038 1.2180900573730469             0              0 healthcare technology

Download a zip file of all examples and a SQL script file that creates their input tables from the attachment in the left sidebar.