1.0 - 8.00 - KMeans Example 3: InitialSeeds, ClusteredOutput - Teradata Vantage

Teradata® Vantage Machine Learning Engine Analytic Function Reference

Product
Teradata Vantage
Release Number
1.0
8.00
Release Date
May 2019
Content Type
Programming Reference
Publication ID
B700-4003-098K
Language
English (United States)

SQL Call

SELECT * FROM KMeans (
  ON computers_train1 AS InputTable
  OUT TABLE OutputTable (kmeanssample_output)
  OUT TABLE ClusteredOutput (kmeanssample_clusteredoutput)
  USING
  InitialSeeds ('2249_51_408_8_14', '2165_51_398_7_14.6',
    '2182_51_404_7_14.6', '2204_55_372_7.19_14.6',
    '2419_44_222_6.6_14.3', '2394_44.3_277_7.3_14.5','
    2326_43.6_301_7.11_14.3', '2288_44_325_7_14.4')
) AS dt;

Output

Results Message Table
clusterid price speed hd ram screen size withinss
0 2857.75 62.027027027027 1075.40540540541 21.9459459459459 15.1047297297297 296 2.89798655236483E7
1 1471.77529411765 41.42 261.765882352941 4.13647058823529 14.2341176470588 850 3.12681781317644E7
2 1966.25868725869 64.3745173745174 682.048262548263 9.08880308880309 14.8552123552124 518 3.75512305289583E7
3 1863.05935613682 44.3581488933602 242.107645875252 4.62374245472837 14.3460764587525 994 2.36222057082472E7
4 3765.46783625731 65.7953216374269 603.818713450292 12.9824561403509 15.2222222222222 171 3.52858142923985E7
5 2977.40142095915 60.8081705150977 432.916518650089 12.113676731794 14.8827708703375 563 2.21058786252213E7
6 2553.49551856594 54.0832266325224 465.946222791293 10.6171574903969 14.7477592829706 781 2.97090384046078E7
7 2226.79880239521 50.6071856287425 309.419161676647 6.3185628742515 14.5329341317365 835 2.19925897556877E7
  Converged: False    
  NumberofIterations: 10    
  Numberofclusters: 8    
  Successfully created Output table    
  Successfully created Clustered Output table    
  Total_WithinSS: 2.305148009705335E8    
  Between_SS: 1.8080726915544217E9    

This query returns the following table:

SELECT * FROM kmeanssample_output ORDER BY clusterid;
kmeanssample_output
clusterid price speed hd ram screen size withinss
0 2857.75 62.027027027027 1075.40540540541 21.9459459459459 15.1047297297 296 28979865.5236483
1 1471.77529411765 41.42 261.765882352941 4.13647058823529 14.2341176471 850 31268178.1317644
2 1966.25868725869 64.3745173745174 682.048262548263 9.08880308880309 14.8552123552 518 37551230.5289583
3 1863.05935613682 44.3581488933602 242.107645875252 4.62374245472837 14.3460764588 994 23622205.7082472
4 3765.46783625731 65.7953216374269 603.818713450292 12.9824561403509 15.2222222222 171 35285814.2923985
5 2977.40142095915 60.8081705150977 432.916518650089 12.113676731794 14.8827708703 563 22105878.6252213
6 2553.49551856594 54.0832266325224 465.946222791293 10.6171574903969 14.747759283 781 29709038.4046078
7 2226.79880239521 50.6071856287425 309.419161676647 6.3185628742515 14.5329341317 835 21992589.7556877

This query returns the following table:

SELECT * FROM kmeanssample_clusteredoutput ORDER BY id;
kmeanssample_clusteredoutput
id clusterid
1 1
2 3
3 1
4 3
5 5
6 4
7 3
8 3
9 7
12 6
13 3
14 7
16 7
17 1
18 7
19 7
20 4
... ...