GTree Arguments - Teradata Vantage

Machine Learning Engine Analytic Function Reference

Product
Teradata Vantage
Release Number
8.00
1.0
Published
May 2019
Language
English (United States)
Last Update
2019-11-22
dita:mapPath
blj1506016597986.ditamap
dita:ditavalPath
blj1506016597986.ditaval
dita:id
B700-4003
lifecycle
previous
Product Category
Teradata Vantageā„¢
TargetKey
Specify the names of the columns in the edges table that identify the target vertex of an edge.
AllowCycles
[Optional] Specify whether the input graph can include cycles.
Default: 'false'
MaxDepth
[Optional] Specify the maximum depth to which the function traverses the graph (a nonnegative integer).
Default: 1000
OutputType
[Optional] Specify whether the function outputs all paths ('all') or only paths that end by reaching a leaf vertex, a cycle, or the maximum number of iterations ('end').
Default: 'end'
Results
[Required if you omit EdgeResults.] Specify the aggregate functions to calculate along each vertex in each path (see the following table). The function outputs a results column for each aggregate function. The column name is alias, if specified; otherwise it is func(expr).
EdgeResults
[Required if you omit Results.] Specify the aggregate functions to calculate along each edge in each path (see the following table). The function outputs a results column for each aggregate function. The column name is alias, if specified; otherwise it is func(expr).
FinalEdgeFlag
[Optional] Specify whether to include the edge that follows the final vertex when calculating the functions that EdgeResults specifies.
Default: 'true'

Aggregate Functions Supported by GTree Function

The following table describes the aggregate functions that the Results and EdgeResults arguments support. In function syntax, expr, expr1, and expr2 are values from the vertices or edges table.

Aggregate Function Description Return Value Data Type
correl(expr1, expr2) Returns Pearson product-moment correlation between expr1 and expr2 on path. DOUBLE PRECISION
count(expr [,...]) Returns number of vertices in path where no expr is null. INTEGER
countdistinct(expr) Returns number of distinct values of expr in vertices on path. INTEGER
current(expr) Returns value of expr at final vertex in path. Same as input
cycle() Returns '1' if GTree function ends path by completing a cycle (that is, by visiting a vertex a second time), '0' otherwise.
Specify this function only in EdgeResults argument.
BYTEINT
histogram(expr) Returns a JSON string that contains counts of each distinct value of expr on path. VARCHAR
leaf() Returns '1' if GTree function ends path by reaching a leaf vertex (that is, a vertex with no outgoing edges), '0' otherwise. BYTEINT
level() Returns number of vertices on path from root vertex to last visited vertex. INTEGER
max(expr) Returns maximum value of expr over all vertices from root vertex to last visited vertex. Same as input
maxiteration() Returns '1' if GTree function ends path by reaching maximum number of iterations specified by MaxDepth argument, '0' otherwise. BYTEINT
mean(expr) Returns mean value of expr over all vertices from root vertex to last visited vertex. DOUBLE PRECISION
min(expr) Returns minimum value of expr over all vertices from root vertex to last visited vertex. Same as input
path(expr[,...]) Returns a string that represents path from root vertex to last visited vertex. string has form 'v1->v2->v3...' for a vertex path and '.-v1->.-v2->.-v3->...' for an edge path, where vn is value of nth expr. CLOB
propagate(expr) Returns value of expr at root vertex. Same as input
range(expr) Returns difference between minimum and maximum values of expr on path (max(expr) - min(expr)). Same as input
stdev(expr) Returns standard deviation of expr over all vertices from root vertex to last visited vertex. DOUBLE PRECISION
sum(expr) Returns sum of expr over all vertices from root vertex to last visited vertex. Same as input
sumproduct(expr1, expr2) Calculates product of expr1 and expr2 at each vertex on path and then returns sum of products. Same as input if expr1 and expr2 have same type, otherwise NUMERIC