Untitled
unknown
python
3 years ago
201 B
13
Indexable
def calculate_purity(y_true, y_pred):
conf_matrix=confusion_matrix(y1, labels)
Pj = conf_matrix.max(axis=0)
Mj = conf_matrix.sum(axis=0)
purity = np.sum(Pj)/np.sum(Mj)
return purityEditor is loading...