AMLGenerator Example - Teradata Vantage

Machine Learning Engine Analytic Function Reference

Product
Teradata Vantage
Release Number
8.10
1.1
Published
October 2019
Language
English (United States)
Last Update
2019-12-31
dita:mapPath
ima1540829771750.ditamap
dita:ditavalPath
jsj1481748799576.ditaval
dita:id
B700-4003
lifecycle
previous
Product Category
Teradata Vantageā„¢

Input

Model: glass_attribute_table_output
node_id node_size node_label left_id left_size right_id right_size attribute
0 100 2 1 32 2 68 Mg
1 32 2 3 11 4 21 Na
2 68 1 5 28 6 40 Ca
3 11 2 7 10 8 1 Fe
4 21 7 9 14 10 7 K
5 28 2 11 4 12 24 Al
6 40 1 13 29 14 11 Na

SQL Call

RequestColNames specifies all the attributes on which the single decision tree function was trained.

SELECT * FROM AMLGenerator (
  ON glass_attribute_table_output AS Model
  USING
  ModelType ('SDT')
  RequestColNames ('pid','RI','Na','Mg','Al','Si','K','Ca','Ba','Fe')
  RequestColTypes ('int','double','double','double','double',
                   'double','double','double','double','double')
  AMLPrefix ('glass_model')
  RequestArgName1 ('ATTRTABLE_AttributeColumns')
  RequestArgVal1 ('RI','Na','Mg','Al','Si','K','Ca','Ba','Fe')
  RequestArgName2 ('ATTRTABLE_pidColumns')
  RequestArgVal2 ('pid')
  OverwriteOutput ('true')
) AS dt;

Output

The AML file glass_model.aml (shown below) is created and installed on ML Engine. To download the file, use the command call pm.download_afile ('glass_model.aml').

<?xml version="1.0" encoding="UTF-8"?>
<model xmlns:aml="Aster Model Language">
  <name>SDT</name>
  <version>6.21_rel_1.0_r55243</version>
  <copyright>Copyright (c) 2015-2016 by Teradata Corporation. All rights              reserved.</copyright>
  <columns entity="model" name="glass_attribute_table_output">
    <c type="long">node_id</c>
    <c type="long">node_size</c>
    <c type="string">node_label</c>
    <c type="long">left_id</c>
    <c type="long">left_size</c>
    <c type="long">right_id</c>
    <c type="long">right_size</c>
    <c type="string">attribute</c>
  </columns>
  <columns entity="request">
    <c type="int">pid</c>
    <c type="double">RI</c>
    <c type="double">Na</c>
    <c type="double">Mg</c>
    <c type="double">Al</c>
    <c type="double">Si</c>
    <c type="double">K</c>
    <c type="double">Ca</c>
    <c type="double">Ba</c>
    <c type="double">Fe</c>
  </columns>
  <data entity="model" name="glass_attribute_table_output">
    <d>0,100,2,1,32,2,68,Mg</d>
    <d>1,32,2,3,11,4,21,Na</d>
    <d>2,68,1,5,28,6,40,Ca</d>
    <d>3,11,2,7,10,8,1,Fe</d>
    <d>4,21,7,9,14,10,7,K</d>
    <d>5,28,2,11,4,12,24,Al</d>
    <d>6,40,1,13,29,14,11,Na</d>
    <checksum>d49eed5708d45967b88444a88e99bdb0bc11e11d</checksum>
  </data>
  <params>
      <p name="AttrTableAttributeColumns">RI,Na,Mg,Al,Si,K,Ca,Ba,Fe</p>
      <p name="AttrTablePidColumns">pid</p>
  </params>
</model>