- InputTable: computers_train1, as in KMeans Example: NumClusters, UnpackColumns ('false')
- CentroidsTable: kmeanssample_centroid, output by KMeans Example: NumClusters, UnpackColumns ('true')
SQL Call
SELECT * FROM KMeans ( ON computers_train1 AS InputTable ON kmeanssample_centroid AS CentroidsTable OUT TABLE OutputTable(kmeanssample_output2) OUT TABLE ClusterAssignmentTable(kmeanssample_clusteredoutput2) ) AS dt;
Output
clusterid mean size withinss --------- ------------------------------------------------------------------------------------ ---- ---------------- 0 1435.6 26.6 107.0 3.2 14.0 5 40551.1999999993 1 2604.92307692308 42.0 219.384615384615 7.07692307692308 14.7692307692308 13 158637.230769217 2 3072.21428571429 52.6428571428571 271.071428571429 8.57142857142857 14.7142857142857 14 586706.785714269 3 4026.42857142857 59.0 432.285714285714 9.14285714285714 14.2857142857143 7 324109.428571463 4 1660.57142857143 29.5714285714286 139.285714285714 4.28571428571429 14.1428571428571 7 27135.1428571418 5 1808.5 31.0 138.75 4.5 14.25 4 7173.5 6 2006.86666666667 39.2 164.333333333333 4.4 14.0666666666667 15 84880.0 7 2280.46666666667 42.5333333333333 199.4 5.86666666666667 14.0666666666667 15 118565.733333319 --------- ------------------------------------------------------------------------------------ ---- ---------------- Converged : True Number of Iterations : 5 Number of clusters : 8 Successfully created Output table Successfully created Clustered Output table Total_WithinSS : 1347759.0212454093 Between_SS : 3.8199122728754565E7
SELECT * FROM kmeanssample_output2;
clusterid mean size withinss --------- ------------------------------------------------------------------------------------ ---- ---------------- 1 2604.92307692308 42.0 219.384615384615 7.07692307692308 14.7692307692308 13 158637.230769217 3 4026.42857142857 59.0 432.285714285714 9.14285714285714 14.2857142857143 7 324109.428571463 5 1808.5 31.0 138.75 4.5 14.25 4 7173.5 7 2280.46666666667 42.5333333333333 199.4 5.86666666666667 14.0666666666667 15 118565.733333319 0 1435.6 26.6 107.0 3.2 14.0 5 40551.1999999993 2 3072.21428571429 52.6428571428571 271.071428571429 8.57142857142857 14.7142857142857 14 586706.785714269 4 1660.57142857143 29.5714285714286 139.285714285714 4.28571428571429 14.1428571428571 7 27135.1428571418 6 2006.86666666667 39.2 164.333333333333 4.4 14.0666666666667 15 84880.0
SELECT * FROM kmeanssample_clusteredoutput2;
id clusterid --- --------- 7 4 22 1 3 4 12 1 96 0 82 1 100 4 79 1 17 4 99 1 68 0 85 1 55 7 34 1 37 7 88 5 67 7 57 6 42 3 77 6 20 3 50 6 25 3 78 2 14 7 5 2 6 3 41 2 49 7 58 2 64 7 56 6 71 3 90 2 80 4 19 6 26 0 74 2 1 0 31 6 73 4 13 6 21 4 87 6 89 0 81 2 40 7 72 1 39 7 62 5 54 7 4 5 44 7 43 1 61 3 2 5 18 7 36 1 47 7 84 1 69 7 33 1 9 7 63 1 28 3 95 2 16 7 35 6 27 6 76 2 24 2 60 6 98 6 75 2 8 6 97 6 53 2 23 2 32 6 83 2
Download a zip file of all examples and a SQL script file that creates their input tables from the attachment in the left sidebar.