WRITE · TRACE · UNDERSTAND
Silhouette Clustering Score
A cluster assignment can be compact yet poorly separated.
Your experiment
silhouette(points, labels) returns the mean silhouette for 1D points using absolute distance. There are at least two nonempty clusters. A singleton has score 0; if a=b=0 also use 0.
Python runs in your browser. Your draft stays on this device.
What to look for
A cluster assignment can be compact yet poorly separated. Compare each point’s mean distance within its cluster with the nearest other cluster; singletons score zero.
Watch your code work
Ready to experimentWrite a solution or load the worked answer, then choose Trace & check.
Step through arrays, variables and training curves produced by your own Python.