TD_DecisionForestPredict Examples | DecisionForestPredict - Example: How to Use TD_DecisionForestPredict - Analytics Database

Database Analytic Functions

Deployment
VantageCloud
VantageCore
Edition
Enterprise
IntelliFlex
VMware
Product
Analytics Database
Release Number
17.20
Published
June 2022
Language
English (United States)
Last Update
2024-10-04
dita:mapPath
gjn1627595495337.ditamap
dita:ditavalPath
ayr1485454803741.ditaval
dita:id
jmh1512506877710
lifecycle
latest
Product Category
Teradata Vantageā„¢

Example: TD_DecisionForestPredict Used to Classify Home Styles

TD_DecisionForestPredict InputTable
SN Price LotSize Bedrooms Bathrooms Stories Driveways Recroom FullBase GasHW AirCo GaragePl PrefArea HomeStyle
1 42000 4960 2 1 1 1 0 0 0 0 0 0 1
2 130000 6000 4 1 2 1 0 1 0 0 2 0 3
3 60000 2953 3 1 2 1 0 1 0 1 0 0 2
4 43000 3750 3 1 2 1 0 0 0 0 0 0 1
5 86900 4300 6 2 2 1 0 0 0 0 0 0 2
6 141000 8100 4 1 2 1 1 1 0 1 2 1 3
ModelTable
task_index tree_num tree_order classification_tree
0 0 0 {"id_":1,"size_":10,"maxDepth_":5,"responseCounts_":{"2":7,"3":3},"nodeType_":"CLASSIFICATION_NODE","split_":{"splitValue_":93721.000000,"attr_":"price","type_":"CLASSIFICATION_NUMERIC_SPLIT","score_":0.420000,"scoreImprove_":0.420000,"leftNodeSize_":7,"rightNodeSize_":3},"leftChild_":{"id_":2,"size_":7,"maxDepth_":4,"label_":"2","nodeType_":"CLASSIFICATION_LEAF"},"rightChild_":{"id_":3,"size_":3,"maxDepth_":4,"label_":"3","nodeType_":"CLASSIFICATION_LEAF"}}
1 0 0 {"id_":1,"size_":13,"maxDepth_":5,"responseCounts_":"1":4,"2":8,"3":1},"nodeType_":"CLASSIFICATION_NODE","split_":"splitValue_":49750.000000,"attr_":"price","type_":"CLASSIFICATION_NUMERIC_SPLIT","score_":0.520710,"scoreImprove_":0.383958,"leftNodeSize_":4,"rightNodeSize_":9},"leftChild_":"id_":2,"size_":4,"maxDepth_":4,"label_":"1","nodeType_":"CLASSIFICATION_LEAF"},"rightChild_":"id_":3,"size_":9,"maxDepth_":4,"responseCounts_":{"2":8,"3":1},"nodeType_":"CLASSIFICATION_NODE","split_":"splitValue_":82750.000000,"attr_":"price","type_":"CLASSIFICATION_NUMERIC_SPLIT","score_":0.197531,"scoreImprove_":0.136752,"leftNodeSize_":8,"rightNodeSize_":1},"leftChild_":{"id_":6,"size_":8,"maxDepth_":3,"label_":"2","nodeType_":"CLASSIFICATION_LEAF"},"rightChild_":{"id_":7,"size_":1,"maxDepth_":3,"label_":"3","nodeType_":"CLASSIFICATION_LEAF"}}}
2 0 0 {"id_":1,"size_":6,"maxDepth_":5,"responseCounts_":{"1":1,"2":5},"nodeType_":"CLASSIFICATION_NODE","split_":{"splitValue_":63000.000000,"attr_":"price","type_":"CLASSIFICATION_NUMERIC_SPLIT","score_":0.277778,"scoreImprove_":0.277778,"leftNodeSize_":1,"rightNodeSize_":5},"leftChild_":{"id_":2,"size_":1,"maxDepth_":4,"label_":"1","nodeType_":"CLASSIFICATION_LEAF"},"rightChild_":{"id_":3,"size_":5,"maxDepth_":4,"label_":"2","nodeType_":"CLASSIFICATION_LEAF"}}
3 0 0 {"id_":1,"size_":15,"maxDepth_":5,"label_":"2","nodeType_":"CLASSIFICATION_LEAF"}
4 0 0 {"id_":1,"size_":13,"maxDepth_":5,"responseCounts_":{"1":8,"2":2,"3":3},"nodeType_":"CLASSIFICATION_NODE","split_":{"splitValue_":55000.000000,"attr_":"price","type_":"CLASSIFICATION_NUMERIC_SPLIT","score_":0.544379,"scoreImprove_":0.359763,"leftNodeSize_":8,"rightNodeSize_":5},"leftChild_":{"id_":2,"size_":8,"maxDepth_":4,"label_":"1","nodeType_":"CLASSIFICATION_LEAF"},"rightChild_":{"id_":3,"size_":5,"maxDepth_":4,"responseCounts_":{"2":2,"3":3},"nodeType_":"CLASSIFICATION_NODE","split_":{"splitValue_":105500.000000,"attr_":"price","type_":"CLASSIFICATION_NUMERIC_SPLIT","score_":0.480000,"scoreImprove_":0.184615,"leftNodeSize_":2,"rightNodeSize_":3},"leftChild_":{"id_":6,"size_":2,"maxDepth_":3,"label_":"2","nodeType_":"CLASSIFICATION_LEAF"},"rightChild_":{"id_":7,"size_":3,"maxDepth_":3,"label_":"3","nodeType_":"CLASSIFICATION_LEAF"}}}
5 0 0 {"id_":1,"size_":15,"maxDepth_":5,"responseCounts_":{"1":11,"2":3,"3":1},"nodeType_":"CLASSIFICATION_NODE","split_":{"splitValue_":56500.000000,"attr_":"price","type_":"CLASSIFICATION_NUMERIC_SPLIT","score_":0.417778,"scoreImprove_":0.317778,"leftNodeSize_":11,"rightNodeSize_":4},"leftChild_":{"id_":2,"size_":11,"maxDepth_":4,"label_":"1","nodeType_":"CLASSIFICATION_LEAF"},"rightChild_":{"id_":3,"size_":4,"maxDepth_":4,"responseCounts_":{"2":3,"3":1},"nodeType_":"CLASSIFICATION_NODE","split_":{"splitValue_":102000.000000,"attr_":"price","type_":"CLASSIFICATION_NUMERIC_SPLIT","score_":0.375000,"scoreImprove_":0.100000,"leftNodeSize_":3,"rightNodeSize_":1},"leftChild_":{"id_":6,"size_":3,"maxDepth_":3,"label_":"2","nodeType_":"CLASSIFICATION_LEAF"},"rightChild_":{"id_":7,"size_":1,"maxDepth_":3,"label_":"3","nodeType_":"CLASSIFICATION_LEAF"}}}
6 0 0 {"id_":1,"size_":4,"maxDepth_":5,"responseCounts_":{"1":1,"2":3},"nodeType_":"CLASSIFICATION_NODE","split_":{"splitValue_":68000.000000,"attr_":"price","type_":"CLASSIFICATION_NUMERIC_SPLIT","score_":0.375000,"scoreImprove_":0.375000,"leftNodeSize_":1,"rightNodeSize_":3},"leftChild_":{"id_":2,"size_":1,"maxDepth_":4,"label_":"1","nodeType_":"CLASSIFICATION_LEAF"},"rightChild_":{"id_":3,"size_":3,"maxDepth_":4,"label_":"2","nodeType_":"CLASSIFICATION_LEAF"}}

TD_DecisionForestPredict Call

SELECT * FROM TD_DecisionForestPredict (
ON input_table AS InputTable PARTITION BY ANY
ON model_table AS ModelTable DIMENSION
USING
  IdColumn ('sn')
  Accumulate('homestyle')
  Detailed('false')
) AS dt;

TD_DecisionForestPredict Output

sn Prediction Confidence_Lower Confidence_Higher HomeStyle
1 1 0.7142857142 0.7142857142 1
2 3 0.5714285714 0.5714285714 3
3 2 0.7142857142 0.7142857142 2
4 1 0.7142857142 0.7142857142 1
5 2 0.8571428571 0.8571428571 2
6 3 0.5714285714 0.5714285714 3