Implement K-Means from scratch.
Use PostgreSQL to cluster two-dimensional points into eight clusters. Run exactly three assignment and centroid-update iterations using the provided initial centroids. Exclude points with a NULL coordinate and resolve equal-distance assignments by choosing the lowest centroid ID.
point_id, cluster_id, and distance_squaredcluster_id, then point_iddistance_squared to six decimal places| Column | Type | Description |
|---|---|---|
| point_idPK | INT | Unique point identifier |
| x | NUMERIC(10,4) | First coordinate |
| y | NUMERIC(10,4) | Second coordinate |
| Column | Type | Description |
|---|---|---|
| centroid_idPK | INT | Unique initial centroid identifier |
| x | NUMERIC(10,4) | Initial centroid x-coordinate |
| y | NUMERIC(10,4) | Initial centroid y-coordinate |