Untitled
Anonymous
python
01/28/2023 7:24 PM
268 B
22
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...