RuleTree.evaluation.evaluate_clustering#
- evaluate_clustering(labels_true, labels_pred) dict[source]#
Agreement between a clustering and known classes (external metrics).
- Parameters:
labels_true (array-like of shape (n_samples,)) – Known classes.
labels_pred (array-like of shape (n_samples,)) – Cluster labels.
- Returns:
scores –
adjusted_rand,rand_score,adjusted_mutual_info,mutual_info,normalized_mutual_info,homogeneity,completeness,v_measureandfowlkes_mallows.- Return type:
See also
evaluate_clustering_internalmetrics that do not need the classes.
Examples
>>> from sklearn.datasets import make_blobs >>> from RuleTree import RuleTreeCluster >>> from RuleTree.evaluation import evaluate_clustering >>> X, y = make_blobs(n_samples=300, centers=3, cluster_std=0.5, random_state=0) >>> labels = RuleTreeCluster(max_depth=3, random_state=0).fit_predict(X) >>> round(evaluate_clustering(y, labels)["adjusted_rand"], 2) 0.95