Untitled

 avatar
unknown
python
2 years ago
201 B
7
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 purity
Editor is loading...