def predict_proba(self, p):
        """ Calculate the calibrated probabilities

        Parameters
        ----------
        y_prob : array-like of shape = [n_samples, 2]
            Predicted probabilities to be calibrated using calibration map

        Returns
        -------
        y_prob_cal : array-like of shape = [n_samples, 1]
            Predicted calibrated probabilities
        """

        # TODO: Check input
        if p.size != p.shape[0]:
            p = p[:, 1]

        calibrated_proba = np.zeros(p.shape[0])
        for i in range(self.calibration_map.shape[0]):
            calibrated_proba[np.logical_and(self.calibration_map[i, 1] <= p, self.calibration_map[i, 0] > p)] = \
                self.calibration_map[i, 2]

        # TODO: return 2D and refactor
        return calibrated_proba
def predict_proba ( self , p ) : if p . size != p . shape [ 0 ] : p = p [ : , 1 ] calibrated_proba = np . zeros ( p . shape [ 0 ] ) for i in range ( self . calibration_map . shape [ 0 ] ) : calibrated_proba [ np . logical_and ( self . calibration_map [ i , 1 ] <= p , self . calibration_map [ i , 0 ] > p ) ] = self . calibration_map [ i , 2 ] return calibrated_proba
Calculate the calibrated probabilities

        Parameters
        ----------
        y_prob : array-like of shape = [n_samples, 2]
            Predicted probabilities to be calibrated using calibration map

        Returns
        -------
        y_prob_cal : array-like of shape = [n_samples, 1]
            Predicted calibrated probabilities