{"version":"1.0","type":"rich","title":"Super naive but fast kmeans","description":"This example shows a fast, approximate k-means clustering of 500,000 geographic points, grouping them into up to 16 clusters by nearest centroid. It first reduces the data by aggregating points into a coarse grid, then uses a recursive PostGIS query with `ST_Centroid`, `ST_Collect`, and `ST_Distance` to iteratively refine cluster centers over 20 passes. The final query assigns each original point to its closest cluster using the `<->` spatial index operator, outputting a `kmean_id` for every record. The approach prioritizes speed over precision, completing in about 25 seconds.","provider_name":"VizHub AI Studio","provider_url":"https://next.vizhub.com","html":"<iframe src=\"https://next.vizhub.com/viz/gist-4171372?mode=embed\" width=\"960\" height=\"500\" scrolling=\"no\" frameborder=\"1\"></iframe>","width":960,"height":500,"cache_age":3600}