y_pred = self.label_encoder.inverse_transform(y_pred)
except AttributeError:
// if a mapping is passed to class apply it here.
y = np.array([self.label_encoder[x] for x in y])
y_pred = np.array([self.label_encoder[x] for x in y_pred])
// Compute the confusion matrix and class counts
self.confusion_matrix_ = confusion_matrix_metric(
After Change
self.confusion_matrix_ = confusion_matrix_metric(
y, y_pred, labels=labels, sample_weight=self.sample_weight
)
self.class_counts_ = dict(zip(*np.unique(y, return_counts=True)))
// Make array of only the classes actually being used.
// Needed because sklearn confusion_matrix only returns counts for