Saltar al contenido principal

Silhouette

Metric
DashAI.back.metrics.clustering.Silhouette

Mean Silhouette Coefficient over all clustered samples.

Silhouette measures how similar each sample is to samples in its own cluster compared with samples in the nearest different cluster. Values close to 1 indicate compact and well-separated clusters, values near 0 indicate overlapping clusters, and negative values suggest that samples may have been assigned to the wrong cluster.

Range: [-1, 1], higher is better (MAXIMIZE = True).

References​

Methods​

score(x: 'DashAIDataset | pd.DataFrame', labels: 'np.ndarray | list') -> float | None

Defined on Silhouette

Calculate the Silhouette score for clustering assignments.

Parameters

x : DashAIDataset or pandas.DataFrame
Feature data used by the clustering model.
labels : np.ndarray or list
Cluster labels assigned to each sample.

Returns

float | None
Silhouette score, or None when the score is not defined for the current label distribution.

get_metadata(cls: 'BaseMetric') -> Dict[str, Any]

Defined on BaseMetric

Get metadata values for the current metric.

Returns

Dict[str, Any]
Dictionary with the metadata

get_registry(cls) -> Dict[str, Type[ForwardRef('ClusteringMetric')]]

Defined on ClusteringMetric

Return concrete clustering metric classes keyed by class name.

Compatible with​