CalinskiHarabasz
DashAI.back.metrics.clustering.CalinskiHarabasz
Ratio between inter-cluster and intra-cluster dispersion.
Calinski-Harabasz evaluates how dense and well-separated clusters are by comparing dispersion between clusters with dispersion within clusters. Higher values generally indicate better-defined clusters.
Range: [0, +inf), higher is better (MAXIMIZE = True).
References
- [1] Calinski, T. & Harabasz, J. (1974). "A dendrite method for cluster analysis." Communications in Statistics, 3(1), 1-27.
- [2] https://scikit-learn.org/stable/modules/generated/sklearn.metrics.calinski_harabasz_score.html
Methods
score(x: 'DashAIDataset | pd.DataFrame', labels: 'np.ndarray | list') -> float | None
CalinskiHarabaszCalculate the Calinski-Harabasz 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
- Calinski-Harabasz score, or
Nonewhen the score is not defined for the current label distribution.
get_metadata(cls: 'BaseMetric') -> Dict[str, Any]
BaseMetricGet metadata values for the current metric.
Returns
- Dict[str, Any]
- Dictionary with the metadata
get_registry(cls) -> Dict[str, Type[ForwardRef('ClusteringMetric')]]
ClusteringMetricReturn concrete clustering metric classes keyed by class name.