GMM Example: Basic GMM, Diagonal Covariance, Unpacked Output - 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

See GMM Examples Input.

SQL Call

DROP TABLE gmm_output_ex2;

SELECT * FROM GMM(
  ON (SELECT 1) AS InitialValues PARTITION BY 1
  ON gmm_iris_train AS InputTable
  OUT TABLE OutputTable (gmm_output_ex2)
  USING
  ClusterNum (3)
  CovarianceType ('diagonal')
  MaxIterNum (10)
  PackOutput (0)
) AS dt;

Output

Because the SQL call specifies PackOutput (0), the mean for each dimension is output in a separate column.

property                          value
-----------------------------     --------------------------------------------
Output Table                      Table Name Specified in OutputTable argument
Algorithm Used                    Basic GMM

Stopping Criterion                Algorithm converged with tolerance 0.001
Delta Log Likelihood              0.000306
Number of Iterations              9
Number of Clusters                3
Covariance Type                   diagonal

Number of Data Points             120
Global Mean                       [5.866, 3.055, 3.770, 1.205]
Global Covariance                 [[0.7197, -0.04204, 1.326, 0.5265], [-0.04204, 0.1916, -0.3241, -0.1213], [1.326, -0.3241, 3.167, 1.298], [0.5265, -0.1213, 1.298, 0.5708]]

Log Likelihood                    -299.463
Akaike Information Criterion      650.927 on 26 parameters
Bayesian Information Criterion    723.402 on 26 parameters
SELECT * FROM gmm_output_ex2;
 cluster_id points_assigned covariance_type                 weight           sepal_length            sepal_width           petal_length            petal_width                  cov_1                  cov_2                  cov_3                  cov_4        log_determinant prec
----------- --------------- --------------- ---------------------- ---------------------- ---------------------- ---------------------- ---------------------- ---------------------- ---------------------- ---------------------- ---------------------- ----------------------
          0              80 diagonal         6.66666671404995E-001  6.29999999264475E 000  2.87375000423673E 000  4.93374997654975E 000  1.68124999091003E 000  4.48250005108612E-001  1.12435939872283E-001  6.75236010159825E-001  1.69773448042198E-001 -5.15375919180448E 000 [2.2308979109943294, 8.893953313646076, 1.4809636704110392, 5.890202570141868]
          1              34 diagonal         2.81449285506468E-001  4.96420190082733E 000  3.39489108307423E 000  1.41310305651851E 000  2.18678116022252E-001  1.42644399487320E-001  1.69911879262500E-001  2.20773079340602E-002  5.21182552945754E-003 -1.27899058795552E 001 [7.010439972365617, 5.885403683017837, 45.295377633304305, 191.87134994215393]
          2               6 diagonal         5.18840430885372E-002  5.17812827017366E 000  3.54014393613176E 000  1.60196613519743E 000  4.35969594955617E-001  3.39711206117030E-002  4.30843522590134E-002  7.16344281172976E-003  8.91647791209674E-003 -1.61854587507255E 001 [29.436768113428094, 23.210282795670814, 139.5976803727047, 112.15190682447918]

Download a zip file of all examples and a SQL script file that creates their input tables from the attachment in the left sidebar.