MCPcopy Create free account
hub / github.com/TPCD/DCCL / purity_score

Function purity_score

project_utils/cluster_utils.py:66–70  ·  view source on GitHub ↗
(y_true, y_pred)

Source from the content-addressed store, hash-verified

64
65
66def purity_score(y_true, y_pred):
67 # compute contingency matrix (also called confusion matrix)
68 contingency_matrix = metrics.cluster.contingency_matrix(y_true, y_pred)
69 # return purity
70 return np.sum(np.amax(contingency_matrix, axis=0)) / np.sum(contingency_matrix)
71
72# -------------------------------
73# Mixed Eval Function

Callers 1

evaluate_clusteringFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected