Represents Silhouette method that is used interpretation and validation of consistency. More...
Public Member Functions | |
def | __init__ (self, data, clusters, kwargs) |
Initializes Silhouette method for analysis. More... | |
def | process (self) |
Calculates Silhouette score for each object from input data. More... | |
def | get_score (self) |
Returns Silhouette score for each object from input data. More... | |
Represents Silhouette method that is used interpretation and validation of consistency.
The silhouette value is a measure of how similar an object is to its own cluster compared to other clusters. Be aware that silhouette method is applicable for K algorithm family, such as K-Means, K-Medians, K-Medoids, X-Means, etc., not not applicable for DBSCAN, OPTICS, CURE, etc. The Silhouette value is calculated using following formula:
where - is average distance from object i to objects in its own cluster, - is average distance from object i to objects in the nearest cluster (the appropriate among other clusters).
Here is an example where Silhouette score is calculated for K-Means's clustering result:
Definition at line 45 of file silhouette.py.
def pyclustering.cluster.silhouette.silhouette.__init__ | ( | self, | |
data, | |||
clusters, | |||
kwargs | |||
) |
Initializes Silhouette method for analysis.
[in] | data | (array_like): Input data that was used for cluster analysis. |
[in] | clusters | (list): Cluster that have been obtained after cluster analysis. |
[in] | **kwargs | Arbitrary keyword arguments (available arguments: 'metric'). |
Keyword Args:
Definition at line 84 of file silhouette.py.
def pyclustering.cluster.silhouette.silhouette.get_score | ( | self | ) |
Returns Silhouette score for each object from input data.
Definition at line 151 of file silhouette.py.
def pyclustering.cluster.silhouette.silhouette.process | ( | self | ) |
Calculates Silhouette score for each object from input data.
Definition at line 117 of file silhouette.py.