1.1 - 8.10 - DecisionTree Example: OutputProb - 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

  • AttributeTable: iris_attribute_train
  • ResponseTable: iris_response_train

The preceding tables are created in DecisionTree Example: Create Model.

SQL Call

DROP TABLE iris_attribute_output;

SELECT * FROM DecisionTree (
  ON iris_attribute_train AS AttributeTable
  ON iris_response_train AS ResponseTable
  OUT TABLE OutputTable (iris_attribute_output_prob)
  USING
  NumSplits (3)
  SplitMeasure ('gini')
  MaxDepth (10)
  IDColumns ('pid')
  AttributeNameColumns ('attribute')
  AttributeValueColumn ('attrvalue')
  ResponseColumn ('response')
  MinNodeSize (10)
  ApproxSplits ('false')
  OutputProb ('true')
) AS dt;

Output

 message                                                                                   
 ----------------------------------------------------------------------------------------- 
 Output model table is successfully stored in the table specified in OutputTable argument.
 Depth of the tree is:5
SELECT * FROM iris_attribute_output_prob;
The table looks like iris_attribute_output in DecisionTree Example: Create Model, except that it has additional columns left_label_probdist, right_label_probdist, and prob_label_order.
 node_id node_size node_gini_p         node_entropy        node_chisq_pv node_label  node_majorvotes split_value        split_gini_p        split_entropy       split_chisq_pv         left_id left_size left_label  left_majorvotes right_id right_size right_label right_majorvotes left_bucket right_bucket left_label_probdist                     right_label_probdist                    prob_label_order                                            attribute      
 ------- --------- ------------------- ------------------- ------------- ----------- --------------- ------------------ ------------------- ------------------- ---------------------- ------- --------- ----------- --------------- -------- ---------- ----------- ---------------- ----------- ------------ --------------------------------------- --------------------------------------- ----------------------------------------------------------- -------------- 
       2        90  0.5977777777777777  1.4900684346901674           1.0           2              40 1.7999999523162842  0.2459045406780598  0.6980234505326226 1.1102230246251565E-16       5        41           2              39        6         49           3               38                          0.06522,0.02174,0.02174,0.02174,0.86957 0.72222,0.14815,0.01852,0.07407,0.03704           3,          5,          1,          4,          2 petal_width   
       5        41 0.09280190362879237  0.2811937964320433           1.0           2              39                5.0 0.08001711596063324 0.22991118255484383    0.01747194813144859      11        38           2              37       12          3           2                2                          0.33333,0.16667,0.16667,0.16667,0.16667 0.33333,0.16667,0.16667,0.16667,0.16667           3,          5,          1,          4,          2 petal_length  
      11        38 0.05124653739612184 0.17556502585750336           1.0           2              37                5.5 0.04210526315789473 0.09499053880096872   0.009226867937210503      23         5           2               4       24         33           2               33                          0.33333,0.16667,0.16667,0.16667,0.16667 0.20000,0.20000,0.20000,0.20000,0.20000           3,          5,          1,          4,          2 sepal_length  
      30        24             0.21875  0.5435644431995974           1.0           3              21  3.200000047683716 0.19999999999999996  0.4512050593046013    0.15149399240422035      61        15           3              12       62          9           3                9                          0.65000,0.05000,0.05000,0.20000,0.05000 0.71429,0.07143,0.07143,0.07143,0.07143           3,          5,          1,          4,          2 sepal_width   
       0       130  0.7125443786982248  1.9220774796203766           1.0           1              40                1.0  0.4138461538461538   1.031585839400885                    0.0       1        40           1              40        2         90           2               40                          0.02222,0.02222,0.91111,0.02222,0.02222 0.43158,0.08421,0.01053,0.04211,0.43158           3,          5,          1,          4,          2 petal_width   
       6        49  0.3740108288213244  1.0467992835555564           1.0           3              38  6.300000190734863  0.2924397031539888  0.7112635941634022  1.4851330869192214E-4      13        16           3               8       14         33           3               30                          0.45000,0.40000,0.05000,0.05000,0.05000 0.81579,0.02632,0.02632,0.10526,0.02632           3,          5,          1,          4,          2 sepal_length  
      14        33  0.1652892561983471  0.4394969869215134           1.0           3              30 2.9000000953674316  0.1590909090909091  0.3953195950542527     0.2659534093128423      29         9           3               9       30         24           3               21                          0.71429,0.07143,0.07143,0.07143,0.07143 0.75862,0.03448,0.03448,0.13793,0.03448           3,          5,          1,          4,          2 sepal_width   
      13        16           0.5546875  1.2717822215997983           1.0           3               8  3.200000047683716 0.20833333333333331  0.5548650349110991  0.0019848295804182348      27         7           3               7       28          9           5                7                          0.66667,0.08333,0.08333,0.08333,0.08333 0.15385,0.61538,0.07692,0.07692,0.07692           3,          5,          1,          4,          2 sepal_width

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