This example specifies NumClusters ('3') to obtain three clusters. Because different cluster centers are produced each time you run the example, cluster assignments might differ.
Input
- InputTable: kmodes_input, as in KModes Example: InitialSeedTable
SQL Call
DROP TABLE kmodes_clusters1; SELECT * FROM KModes ( ON kmodes_input AS InputTable OUT TABLE OutputTable (kmodes_clusters1) USING NumClusters (3) TargetColumns ('mpg:carb') NumericAsCategorical('cyl','gear','carb') ) AS dt ;
Output
set_id summary between_cluster_error total_within_cluster_error pseudo_f ------ ------------------------------------------------------------------------------------------------ --------------------- -------------------------- ------------------ 0 Number of Clusters: 3 Number of Iterations: 3 Model Converged: true Number of Data Points: 32.0 196.2432817153941 111.7567182974282 16.974535569904358
SELECT * FROM kmodes_clusters1;
set_id cluster_id mpg disp hp drat wt qsec cyl vs am gear carb within_cluster_ss cluster_weight distance_metric category_weights ------ ---------- ------------------ ------------------ ------------------ ----------------- ------------------- ------------------ --- -- --------- ---- ---- ----------------- -------------- ----------------- ------------------------- 0 1 -0.263918816857143 -0.187711613285714 0.444196075857143 0.492702406571429 -0.0928210307142857 -0.772368446571429 6 s manual 4 4 32.2124975506323 7.0 NULL NULL 0 0 -0.724943435928571 0.890010157642857 0.511912862714286 -0.9434069635 0.794435602785714 -0.180375863 8 s automatic 3 4 43.6174097337196 14.0 EUCLIDEAN,OVERLAP [1.0, 1.0, 1.0, 1.0, 1.0] 0 2 1.09060362018182 -1.01328735581818 -0.934195692090909 0.887161876727273 -0.952031929363636 0.721076473636364 4 v manual 4 2 35.9268110130763 11.0 NULL NULL
Download a zip file of all examples and a SQL script file that creates their input tables.