Input
- input: kmodes_input, found in KModes Example 1: InitialSeedTable
- model: kmodes_clusters, output by KModes Example 1: InitialSeedTable
SQL Call
SELECT * FROM KModesPredict ( ON kmodes_input AS "input" PARTITION BY ANY ON kmodes_clusters AS model DIMENSION ORDER BY distance_metric USING Accumulate ('model') ) AS dt ORDER BY cluster_id, model;
Output
Each input row is assigned one of the three clusters.
cluster_id | mpg | disp | hp | drat | drat | wt | qsec | cyl | vs | am | gear | carb | model |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | -0.811459624 | 0.591244935 | 0.048313323 | -0.835197792 | -0.835197792 | 0.22254417 | -0.307088658 | 8 | S | automatic | 3 | 2 | AMC Javelin |
0 | -1.607882616 | 1.946753815 | 0.850496796 | -1.246659826 | -1.246659826 | 2.077504765 | 0.073449451 | 8 | S | automatic | 3 | 4 | Cadillac Fleetwood |
0 | -1.126710392 | 0.962396176 | 1.433902959 | 0.24956575 | 0.24956575 | 0.636460997 | -1.364760755 | 8 | S | automatic | 3 | 4 | Camaro Z28 |
0 | -0.894420352 | 1.688561647 | 1.215125648 | -0.685575235 | -0.685575235 | 2.174596366 | -0.239934874 | 8 | S | automatic | 3 | 4 | Chrysler Imperial |
0 | -0.761683187 | 0.704204008 | 0.048313323 | -1.564607761 | -1.564607761 | 0.309415603 | -0.54772305 | 8 | S | automatic | 3 | 2 | Dodge Challenger |
0 | -0.960788935 | 1.043081228 | 1.433902959 | -0.722980874 | -0.722980874 | 0.360516446 | -1.124126363 | 8 | S | automatic | 3 | 4 | Duster 360 |
0 | 0.217253407 | 0.220093694 | -0.53509284 | -0.96611753 | -0.96611753 | -0.002299538 | 0.890487156 | 6 | V | automatic | 3 | 1 | Hornet 4 Drive |
0 | -0.230734526 | 1.043081228 | 0.412942174 | -0.835197792 | -0.835197792 | 0.227654255 | -0.46378082 | 8 | S | automatic | 3 | 2 | Hornet Sportabout |
0 | -1.607882616 | 1.849931752 | 0.996348337 | -1.115740088 | -1.115740088 | 2.255335698 | -0.016088927 | 8 | S | automatic | 3 | 4 | Lincoln Continental |
0 | -0.612353876 | 0.363713088 | 0.485867945 | -0.98482035 | -0.98482035 | 0.871524874 | -0.251127171 | 8 | S | automatic | 3 | 3 | Merc 450SE |
0 | -0.463024565 | 0.363713088 | 0.485867945 | -0.98482035 | -0.98482035 | 0.524039143 | -0.139204198 | 8 | S | automatic | 3 | 3 | Merc 450SL |
0 | -0.811459624 | 0.363713088 | 0.485867945 | -0.98482035 | -0.98482035 | 0.575139986 | 0.084641749 | 8 | S | automatic | 3 | 3 | Merc 450SLC |
0 | -0.147773797 | 1.365821438 | 0.412942174 | -0.96611753 | -0.96611753 | 0.641571082 | -0.446992374 | 8 | S | automatic | 3 | 2 | Pontiac Firebird |
0 | -0.3302874 | -0.046166978 | -0.60801861 | -1.564607761 | -1.564607761 | 0.248094592 | 1.326986752 | 6 | V | automatic | 3 | 1 | Valiant |
1 | -0.064813069 | -0.691647397 | 0.412942174 | 0.043834734 | 0.043834734 | -0.457097039 | -1.314395417 | 6 | S | manual | 5 | 6 | Ferrari Dino |
1 | -0.71190675 | 0.970464681 | 1.711020886 | 1.166003916 | 1.166003916 | -0.048290296 | -1.874010283 | 8 | S | manual | 5 | 4 | Ford Pantera L |
1 | -0.844643915 | 0.567039419 | 2.746566825 | -0.105787824 | -0.105787824 | 0.360516446 | -1.818048797 | 8 | S | manual | 5 | 8 | Maserati Bora |
1 | 0.150884825 | -0.570619819 | -0.53509284 | 0.567513685 | 0.567513685 | -0.610399567 | -0.777165145 | 6 | S | manual | 4 | 4 | Mazda RX4 |
1 | 0.150884825 | -0.570619819 | -0.53509284 | 0.567513685 | 0.567513685 | -0.349785269 | -0.46378082 | 6 | S | manual | 4 | 4 | Mazda RX4 Wag |
2 | 0.449543447 | -0.990182091 | -0.783040459 | 0.473999587 | 0.473999587 | -0.917004624 | 0.426006817 | 4 | V | manual | 4 | 1 | Datsun 710 |
2 | 2.042389431 | -1.226589294 | -1.176839619 | 0.90416444 | 0.90416444 | -1.039646647 | 0.907275602 | 4 | V | manual | 4 | 1 | Fiat 128 |
2 | 1.196190002 | -1.224168743 | -1.176839619 | 0.90416444 | 0.90416444 | -1.310481114 | 0.588295128 | 4 | V | manual | 4 | 1 | Fiat X1-9 |
2 | 1.710546517 | -1.25079481 | -1.381031775 | 2.493904115 | 2.493904115 | -1.637526508 | 0.375641479 | 4 | V | manual | 4 | 2 | Honda Civic |
2 | 1.710546517 | -1.094265808 | -0.491337378 | 0.324377029 | 0.324377029 | -1.741772228 | -0.530934604 | 4 | V | manual | 5 | 2 | Lotus Europa |
2 | 0.449543447 | -0.725535119 | -0.753870151 | 0.604919325 | 0.604919325 | -0.068730634 | 2.826754593 | 4 | V | automatic | 4 | 2 | Merc 230 |
2 | 0.715017777 | -0.677930938 | -1.235180235 | 0.174754472 | 0.174754472 | -0.027849959 | 1.203871481 | 4 | V | automatic | 4 | 2 | Merc 240D |
2 | -0.147773797 | -0.509299179 | -0.345485837 | 0.604919325 | 0.604919325 | 0.227654255 | 0.252526208 | 6 | V | automatic | 4 | 4 | Merc 280 |
2 | -0.380063837 | -0.509299179 | -0.345485837 | 0.604919325 | 0.604919325 | 0.227654255 | 0.588295128 | 6 | V | automatic | 4 | 4 | Merc 280C |
2 | 0.980492108 | -0.890939476 | -0.812210767 | 1.55876313 | 1.55876313 | -1.100967659 | -0.642857578 | 4 | S | manual | 5 | 2 | Porsche 914-2 |
2 | 2.291271616 | -1.287909934 | -1.191424773 | 1.166003916 | 1.166003916 | -1.4126828 | 1.147909994 | 4 | V | manual | 4 | 1 | Toyota Corolla |
2 | 0.233845553 | -0.892553178 | -0.724699843 | 0.193457291 | 0.193457291 | -0.76881218 | 1.20946763 | 4 | V | automatic | 3 | 1 | Toyota Corona |
2 | 0.217253407 | -0.885291523 | -0.549677994 | 0.960272899 | 0.960272899 | -0.44687687 | 0.420410668 | 4 | V | manual | 4 | 2 | Volvo 142E |