silhouette
Builtin index · Statistics & ML
silhouette(X, labels)
Input: X, labels · Output: no output
What it is
Per-sample silhouette values of a clustering, as a Vec with one value in [-1, 1] per row of X: (b - a) / max(a, b), where a is the point's mean Euclidean distance to the other points of its own cluster and b the smallest mean distance to the points of any other cluster. Near 1 the point sits well inside its cluster, near 0 on a border, negative closer to another cluster than its own. X is an N-row matrix (a plain Vec is one feature); labels is a length-N numeric vector or list of strings, any values (the cluster ids from kmeans work as they are). A singleton cluster scores 0 (the scikit-learn convention), as does a point whose a and b are both 0. The cost is O(N^2) distances. Errors: fewer than 2 clusters, as many clusters as points, a length mismatch, NaN in X or labels, complex input.
Overloads
One call shape — this function is not overloaded.
| Code | Input | Output | Description |
silhouette(X, labels) | X matrix or VecX is an N-row matrix (a plain Vec is one feature).labels vector or stringlabels is a length-N numeric vector or list of strings, any values (the cluster ids from kmeans work as they are). | not documented yet | Near 1 the point sits well inside its cluster, near 0 on a border, negative closer to another cluster than its own. A singleton cluster scores 0 (the scikit-learn convention), as does a point whose a and b are both 0. The cost is O(N^2) distances. |
Examples
No documentation example calls this form yet. The Statistics & ML chapter is where one belongs.