- Python Machine Learning Cookbook(Second Edition)
- Giuseppe Ciaburro Prateek Joshi
- 63字
- 2021-06-24 15:41:11
How it works...
The sklearn.metrics.silhouette_score function computes the mean silhouette coefficient of all the samples. For each sample, two distances are calculated: the mean intra-cluster distance (x), and the mean nearest-cluster distance (y). The silhouette coefficient for a sample is given by the following equation:
Essentially, y is the distance between a sample and the nearest cluster that does not include the sample.