code: def fit_predict(self, y_prob, cost_mat, y_true_cal=None, y_prob_cal=None):
          
  
          #TODO: Check input
  
          if self.calibration:
              self.cal = ROCConvexHull()
  
              if y_prob_cal is None:
                  y_prob_cal = y_prob
  
              self.cal.fit(y_true_cal, y_prob_cal[:, 1])
              y_prob[:, 1] = self.cal.predict_proba(y_prob[:, 1])
              y_prob[:, 0] = 1 - y_prob[:, 1]
  
          # t_BMR = (cost_fp - cost_tn) / (cost_fn - cost_tn - cost_tp + cost_fp)
          # cost_mat[FP,FN,TP,TN]
          t_bmr = (cost_mat[:, 0] - cost_mat[:, 3]) / (cost_mat[:, 1] - cost_mat[:, 3] - cost_mat[:, 2] + cost_mat[:, 0])
  
          y_pred = np.greater(y_prob[:, 1], t_bmr).astype(np.float)
  
          return y_pred
docs: Calculate the prediction using the Bayes minimum risk classifier.
  
          Parameters
          ----------
          y_prob : array-like of shape = [n_samples, 2]
              Predicted probabilities.
  
          cost_mat : array-like of shape = [n_samples, 4]
              Cost matrix of the classification problem
              Where the columns represents the costs of: false positives, false negatives,
              true positives and true negatives, for each example.
  
          y_true_cal : array-like of shape = [n_samples], optional default = None
              True class to be used for calibrating the probabilities
  
          y_prob_cal : array-like of shape = [n_samples, 2], optional default = None
              Predicted probabilities to be used for calibrating the probabilities
  
          Returns
          -------
          y_pred : array-like of shape = [n_samples]
              Predicted class