def predict_with_rejection(self, X, T=32, return_stats=False,
                               delta=0.1, c_fp=1, c_fn=1, c_r=-1):
        """Predict if a particular sample is an outlier or not, 
           allowing the detector to reject (i.e., output = -2) 
           low confidence predictions.

        Parameters
        ----------
        X : numpy array of shape (n_samples, n_features)
            The input samples.

        T : int, optional(default=32)
            It allows to set the rejection threshold to 1-2exp(-T).
            The higher the value of T, the more rejections are made.
            
        return_stats: bool, optional (default = False)
                      If true, it returns also three additional float values:
                      the estimated rejection rate, the upper bound rejection
                      rate, and the upper bound of the cost.
                       
        delta: float, optional (default = 0.1)
               The upper bound rejection rate holds with probability 1-delta.
                       
        c_fp, c_fn, c_r: floats (positive), optional (default = [1,1, contamination])
                         costs for false positive predictions (c_fp), false negative
                         predictions (c_fn) and rejections (c_r).
                
        Returns
        -------
        outlier_labels : numpy array of shape (n_samples,)
                         For each observation, it tells whether it should be
                         considered as an outlier according to the fitted
                         model. 0 stands for inliers, 1 for outliers and
                         -2 for rejection.
                                   
        expected_rejection_rate:   float, if return_stats is True;
        upperbound_rejection_rate: float, if return_stats is True;
        upperbound_cost:           float, if return_stats is True;

        """
        check_is_fitted(self, ['decision_scores_', 'threshold_', 'labels_'])
        if c_r < 0:
            warnings.warn(
                "The cost of rejection must be positive. "
                "It has been set to the contamination rate.")
            c_r = self.contamination

        if delta <= 0 or delta >= 1:
            warnings.warn(
                "delta must belong to (0,1). It's value has been set to 0.1")
            delta = 0.1

        self.rejection_threshold_ = 1 - 2 * np.exp(-T)
        prediction = self.predict(X)
        confidence = self.predict_confidence(X)
        np.place(confidence, prediction == 0, 1 - confidence[prediction == 0])
        confidence = 2 * abs(confidence - .5)
        prediction[np.where(confidence <= self.rejection_threshold_)[0]] = -2

        if return_stats:
            expected_rejrate, ub_rejrate, ub_cost = self.compute_rejection_stats(
                T=T, delta=delta,
                c_fp=c_fp, c_fn=c_fn, c_r=c_r)
            return prediction, [expected_rejrate, ub_rejrate, ub_cost]

        return prediction
Predict if a particular sample is an outlier or not, 
           allowing the detector to reject (i.e., output = -2) 
           low confidence predictions.

        Parameters
        ----------
        X : numpy array of shape (n_samples, n_features)
            The input samples.

        T : int, optional(default=32)
            It allows to set the rejection threshold to 1-2exp(-T).
            The higher the value of T, the more rejections are made.
            
        return_stats: bool, optional (default = False)
                      If true, it returns also three additional float values:
                      the estimated rejection rate, the upper bound rejection
                      rate, and the upper bound of the cost.
                       
        delta: float, optional (default = 0.1)
               The upper bound rejection rate holds with probability 1-delta.
                       
        c_fp, c_fn, c_r: floats (positive), optional (default = [1,1, contamination])
                         costs for false positive predictions (c_fp), false negative
                         predictions (c_fn) and rejections (c_r).
                
        Returns
        -------
        outlier_labels : numpy array of shape (n_samples,)
                         For each observation, it tells whether it should be
                         considered as an outlier according to the fitted
                         model. 0 stands for inliers, 1 for outliers and
                         -2 for rejection.
                                   
        expected_rejection_rate:   float, if return_stats is True;
        upperbound_rejection_rate: float, if return_stats is True;
        upperbound_cost:           float, if return_stats is True;

        
pyod/models/base.py