def update_conf_mat(self, y, p_y_given_x):
"""
Update the confusion matrix with the given true labels and estimated
labels.
"""
if self.n_out == 1:
y_decision = (p_y_given_x > self.threshold)
else:
y_decision = np.argmax(p_y_given_x, axis=1)
for i in xrange(y.shape[0]):
self.conf_mat[y[i]][y_decision[i]] += 1
评论列表
文章目录