When reference labels exist, a clustering can be scored against them. Implement cluster_metrics(labels_pred, labels_true) returning a dict with five Python floats. Labels are arbitrary integers; let be the number of points, the number of points in predicted cluster and true class , and .
"purity": ."rand": the Rand index over all pairs of points, where counts pairs together in both partitions and pairs separated in both."ari": the adjusted Rand index in the Hubert-Arabie form
Return 1.0 when the denominator is 0."mi": the mutual information with , natural log."nmi": with natural-log entropies of the two partitions; return 1.0 when both entropies are 0.