Untitled

 avatar
unknown
python
2 years ago
316 B
4
Indexable
labels = gmm.predict_proba(X_sample)
def conf_mat_from_prob(y_prob_a,y_true):
    k = len(y_prob_a[0])
    prob_df = pd.DataFrame(y_prob_a)
    prob_df['y'] = y_true
    conf_matrix = prob_df.groupby(by='y').sum() # pred vs true
    return conf_matrix.T.values

conf_mat = conf_mat_from_prob(labels, y_test)
conf_mat
Editor is loading...