KMeans Example 2: NumClusters, UnpackColumns ('true') - 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™

SQL Call

SELECT * FROM KMeans (
  ON computers_train1 AS InputTable
  OUT TABLE OutputTable (kmeanssample_centroid)
  USING
  UnpackColumns ('true')
  NumClusters (8)
  StopThreshold (0.05)
  MaxIterNum (10)
) AS dt;

Output

Results Message Table
clusterid price speed hd ram screen size withinss
0 2825.10760401722 57.8794835007174 433.923959827834 11.5695839311334 14.8393113342898 697 2.6592846654232E7
1 2772.4347826087 64.0372670807453 1058.69565217391 21.1180124223602 15.1428571428571 322 3.51153238012409E7
2 4064.20253164557 63.3924050632911 601.645569620253 11.8987341772152 15.3924050632911 79 1.53429936962023E7
3 1912.39470899471 43.4994708994709 200.079365079365 4.17777777777778 14.3544973544974 945 2.23041374476175E7
4 3330.38034188034 66.3846153846154 566.739316239316 14.2393162393162 14.9273504273504 234 1.83007799957266E7
5 2375.84692028986 51.8940217391304 389.809782608696 8.32246376811594 14.6259057971014 1104 4.5719785486414E7
6 1941.44945355191 60.3606557377049 584.860655737705 8.08196721311475 14.7199453551913 732 4.39483663743181E7
7 1483.39776536313 41.2301675977654 260.330726256983 4.17430167597765 14.2402234636872 895 3.30473392469277E7
  Converged: False    
  NumberofIterations: 10    
  Numberofclusters: 8    
  Successfully created Output table    
  Total_WithinSS: 2.403715727026791E8    
  Between_SS: 1.7982159198222828E9    

This query returns the following table:

SELECT * FROM kmeanssample_centroid;
kmeanssample_centroid
clusterid price speed hd ram screen size withinss
0 1494.15476190476 39.7965367965368 237.25 3.93722943722944 14.20670995671 924 33978821.7456717
1 3723.57368421053 66.0894736842105 598.463157894737 13.0105263157895 15.2 190 39341527.5684214
2 2490.10912698413 53.2440476190476 280.875 6.67063492063492 14.702380952381 504 12097645.7876997
3 2417.94744976816 57.5023183925811 615.910355486862 12.1421947449768 14.8253477588872 647 35927878.9428129
4 2093.86916951081 47.6769055745165 279.397042093288 5.59044368600683 14.4357224118316 879 24744077.3060303
5 2843.82432432432 61.8581081081081 1079.7972972973 21.8648648648649 15.1013513513514 296 30118578.2972965
6 2941.42062193126 60 435.193126022913 12.1047463175123 14.8346972176759 611 23218919.7119465
7 1832.95611285266 53.0208986415883 417.905956112853 6.07523510971787 14.5454545454545 957 51999321.1306162