docs: def _calculate_gain(self, cost_base, y_true, X, cost_mat, split):
          """ Private function to calculate the gain in cost of using split in the
           current node.
  
          Parameters
          ----------
          cost_base : float
              Cost of the naive prediction
  
          y_true : array indicator matrix
              Ground truth (correct) labels.
  
          X : array-like of shape = [n_samples, n_features]
              The input samples.
  
          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.
  
          split : tuple of len = 2
              split[0] = feature to split = j
              split[1] = where to split = l
  
          Returns
          -------
          tuple(gain : float, left node prediction : int)
  
          """
  
          # Check if cost_base == 0, then no gain is possible
          #TODO: This must be check in _best_split
          if cost_base == 0.0:
              return 0.0, int(np.sign(y_true.mean() - 0.5) == 1)  # In case cost_b==0 and pi_1!=(0,1)
  
          j, l = split
          filter_Xl = (X[:, j] <= l)
          filter_Xr = ~filter_Xl
          n_samples, n_features = X.shape
  
          # Check if one of the leafs is empty
          #TODO: This must be check in _best_split
          if np.nonzero(filter_Xl)[0].shape[0] in [0, n_samples]:  # One leaft is empty
              return 0.0, 0.0
  
          # Split X in Xl and Xr according to rule split
          Xl_cost, Xl_pred, _ = self._node_cost(y_true[filter_Xl], cost_mat[filter_Xl, :])
          Xr_cost, _, _ = self._node_cost(y_true[filter_Xr], cost_mat[filter_Xr, :])
  
          if self.criterion_weight:
              n_samples_Xl = np.nonzero(filter_Xl)[0].shape[0]
              Xl_w = n_samples_Xl * 1.0 / n_samples
              Xr_w = 1 - Xl_w
              gain = round((cost_base - (Xl_w * Xl_cost + Xr_w * Xr_cost)) / cost_base, 6)
          else:
              gain = round((cost_base - (Xl_cost + Xr_cost)) / cost_base, 6)
  
          return gain, Xl_pred