1.1 - 8.10 - DecisionTree Example: Alternate Input Format - Teradata Vantage

Teradata Vantage™ - Machine Learning Engine Analytic Function Reference

Product
Teradata Vantage
Release Number
1.1
8.10
Published
October 2019
Content Type
Programming Reference
Publication ID
B700-4003-079K
Language
English (United States)

Input

The InputTable is a combination of the attribute table and response table of DecisionTree Example: Create Model.

InputTable: iris_altinput
pid attribute attrvalue response
1 petal_width 0.2 1
1 petal_length 1.4 1
1 sepal_width 3.5 1
1 sepal_length 5.1 1
2 petal_width 0.2 1
2 petal_length 1.4 1
2 sepal_width 3 1
2 sepal_length 4.9 1
3 petal_width 0.2 1
3 petal_length 1.3 1
3 sepal_width 3.2 1
3 sepal_length 4.7 1
4 petal_width 0.2 1

SQL Call

DROP TABLE iris_attribute_output_2;

SELECT * FROM DecisionTree (
  ON iris_altinput AS InputTable
  OUT TABLE OutputTable (iris_attribute_output_2)
  USING
  NumSplits (3)
  SplitMeasure ('gini')
  MaxDepth (10)
  IDColumns ('pid')
  AttributeNameColumns ('attribute')
  AttributeValueColumn ('attrvalue')
  ResponseColumn ('response')
  MinNodeSize (10)
  ApproxSplits ('false')
) AS dt;

Output

 message                                                                                   
 ----------------------------------------------------------------------------------------- 
 Output model table is successfully stored in the table specified in OutputTable argument.
 Depth of the tree is:5

This query returns the attribute table (which is the same as in DecisionTree Example: Create Model):

SELECT * FROM iris_attribute_output_2 ORDER BY 1;

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