DecisionTree Example: Alternate Input Format | Teradata Vantage - DecisionTree Example: Alternate Input Format - Teradata Vantage

Machine Learning Engine Analytic Function Reference

Product
Teradata Vantage
Release Number
9.02
9.01
2.0
1.3
Published
February 2022
Language
English (United States)
Last Update
2022-02-10
dita:mapPath
rnn1580259159235.ditamap
dita:ditavalPath
ybt1582220416951.ditaval
dita:id
B700-4003
lifecycle
previous
Product Category
Teradata Vantageā„¢

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.