cluster
Group rows in a table or embedding into labeled segments, add a color_by label column for plots, and write embedding labels back to the parent table.
Instructions
Cluster a table (or an embedding) and add a label column (cluster_) usable as color_by in plot. If run on an embedding, labels are also written back to the parent table. methods: kmeans (k omitted -> silhouette over 2..k_max, with the whole silhouette-by-k table, the Calinski-Harabasz choice and the finest k within 10% of the best, because silhouette favours coarse splits), gmm (k by BIC), dbscan (eps from 5-NN distances), hdbscan, agglomerative. standardize 'auto'/True/False and clip_z as in project. Returns sizes (with a warning when clusters hold <0.5% of rows: outliers, not groups), silhouette, Davies-Bouldin and each cluster's centroid signature (features most displaced from the global mean, in SD units).
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"name": "<name>"
},
"name": "cluster"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| k | No | ||
| name | Yes | ||
| seed | No | ||
| k_max | No | ||
| clip_z | No | ||
| method | No | kmeans | |
| params | No | ||
| features | No | ||
| label_col | No | ||
| standardize | No | auto |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |