docs: def _node_cost(self, y_true, cost_mat):
          """ Private function to calculate the cost of a node.
  
          Parameters
          ----------
          y_true : array indicator matrix
              Ground truth (correct) labels.
  
          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.
  
          Returns
          -------
          tuple(cost_loss : float, node prediction : int, node predicted probability : float)
  
          """
          n_samples = len(y_true)
  
          # Evaluates the cost by predicting the node as positive and negative
          costs = np.zeros(2)
          costs[0] = cost_loss(y_true, np.zeros(y_true.shape), cost_mat)
          costs[1] = cost_loss(y_true, np.ones(y_true.shape), cost_mat)
  
          pi = np.array([1 - y_true.mean(), y_true.mean()])
  
          if self.criterion == 'direct_cost':
              costs = costs
          elif self.criterion == 'pi_cost':
              costs *= pi
          elif self.criterion == 'gini_cost':
              costs *= pi ** 2
          elif self.criterion in 'entropy_cost':
              if pi[0] == 0 or pi[1] == 0:
                  costs *= 0
              else:
                  costs *= -np.log(pi)
  
          y_pred = np.argmin(costs)
  
          # Calculate the predicted probability of a node using laplace correction.
          n_positives = y_true.sum()
          y_prob = (n_positives + 1.0) / (n_samples + 2.0)
  
          return costs[y_pred], y_pred, y_prob