GMMPredict Example - 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ā„¢

The GMMPredict function applies the model created by the GMM function to the test input to cluster the test data.

Input

testdata: gmm_iris_test
id sepal_length sepal_width petal_length petal_width
5 5 3.6 1.4 0.2
10 4.9 3.1 1.5 0.1
15 5.8 4 1.2 0.2
20 5.1 3.8 1.5 0.3
25 4.8 3.4 1.9 0.2
30 4.7 3.2 1.6 0.2
35 4.9 3.1 1.5 0.2
40 5.1 3.4 1.5 0.2
45 5.1 3.8 1.9 0.4
50 5 3.3 1.4 0.2
55 6.5 2.8 4.6 1.5
60 5.2 2.7 3.9 1.4
65 5.6 2.9 3.6 1.3
70 5.6 2.5 3.9 1.1
75 6.4 2.9 4.3 1.3
80 5.7 2.6 3.5 1
85 5.4 3 4.5 1.5
90 5.5 2.5 4 1.3
95 5.6 2.7 4.2 1.3
100 5.7 2.8 4.1 1.3
105 6.5 3 5.8 2.2
110 7.2 3.6 6.1 2.5
115 5.8 2.8 5.1 2.4
120 6 2.2 5 1.5
125 6.7 3.3 5.7 2.1
130 7.2 3 5.8 1.6
135 6.1 2.6 5.6 1.4
140 6.9 3.1 5.4 2.1
145 6.7 3.3 5.7 2.5
150 5.9 3 5.1 1.8

SQL Call

SELECT * FROM GMMPredict (
  ON gmm_output_ex1 AS modeldata DIMENSION
  ON gmm_iris_test AS testdata PARTITION BY id
  USING
  TopK (3)
) AS dt ORDER BY id, prob desc;

Output

The output table shows the dimensions and id of each sample, and the probability that it belongs to each of the three clusters.

id sepal_length sepal_width petal_length petal_width cluster_rank cluster_id prob
5 5 3.59999990463257 1.39999997615814 0.200000002980232 1 0 0.999999996516264
5 5 3.59999990463257 1.39999997615814 0.200000002980232 2 2 3.48373546251981e-09
5 5 3.59999990463257 1.39999997615814 0.200000002980232 3 0 0
10 4.90000009536743 3.09999990463257 1.5 0.100000001490116 1 1 0.999999999978146
10 4.90000009536743 3.09999990463257 1.5 0.100000001490116 2 2 2.18542496451431e-11
10 4.90000009536743 3.09999990463257 1.5 0.100000001490116 3 0 0
15 5.80000019073486 4 1.20000004768372 0.200000002980232 1 1 0.999999998968956
15 5.80000019073486 4 1.20000004768372 0.200000002980232 2 2 1.03104372199014e-09
15 5.80000019073486 4 1.20000004768372 0.200000002980232 3 0 0
20 5.09999990463257 3.79999995231628 1.5 0.300000011920929 1 1 0.999999999970437
20 5.09999990463257 3.79999995231628 1.5 0.300000011920929 2 2 2.9562773726376e-11
20 5.09999990463257 3.79999995231628 1.5 0.300000011920929 3 0 0
25 4.80000019073486 3.40000009536743 1.89999997615814 0.200000002980232 1 1 0.999999998740311
25 4.80000019073486 3.40000009536743 1.89999997615814 0.200000002980232 2 2 1.25968923928218e-09
25 4.80000019073486 3.40000009536743 1.89999997615814 0.200000002980232 3 0 0
... ... ... ... ... ... ... ...