def fit(self, y_prob: np.ndarray, y_true: np.ndarray): """ Learns the bin boundaries and calibration score for each bin. Parameters ---------- y_prob : 1d ndarray Raw probability/score of the positive class. y_true : 1d ndarray Binary true targets. Returns ------- self """ binned_y_true, binned_y_prob = create_binned_data(y_true, y_prob, self.n_bins) self.bins_ = get_bin_boundaries(binned_y_prob) self.bins_score_ = np.array([np.mean(value) for value in binned_y_true]) return self
def fit(self, y_prob: np.ndarray, y_true: np.ndarray): """ Learns the logistic regression weights and the bin boundaries and calibration score for each bin. Parameters ---------- y_prob : 1d ndarray Raw probability/score of the positive class. y_true : 1d ndarray Binary true targets. Returns ------- self """ y_prob_platt = super().fit_predict(y_prob, y_true) binned_y_true, binned_y_prob = create_binned_data(y_true, y_prob_platt, self.n_bins) self.bins_ = get_bin_boundaries(binned_y_prob) self.bins_score_ = np.array([np.mean(value) for value in binned_y_prob]) return self