docstr: Return probability estimates for the training data via leave-one-out.
  
  Returns
  -------
  p : ndarray of shape (n_queries, n_classes), or a list of n_outputs
      of such arrays if n_outputs > 1.
      The class probabilities of the training data samples. Classes are ordered
      by lexicographic order.
code: def predict_proba_loo(self):
      """Return probability estimates for the training data via leave-one-out.
  
      Returns
      -------
      p : ndarray of shape (n_queries, n_classes), or a list of n_outputs
          of such arrays if n_outputs > 1.
          The class probabilities of the training data samples. Classes are ordered
          by lexicographic order.
      """
  
      neigh_dist, neigh_ind = self.kneighbors()
  
      classes_ = self.classes_
      _y = self._y
      if not self.outputs_2d_:
          _y = self._y.reshape((-1, 1))
          classes_ = [self.classes_]
  
      n_queries = len(neigh_dist)
  
      weights = _get_weights(neigh_dist, self.weights)
      if weights is None:
          weights = np.ones_like(neigh_ind)
  
      all_rows = np.arange(n_queries)
      probabilities = []
      for k, classes_k in enumerate(classes_):
          pred_labels = _y[:, k][neigh_ind]
          proba_k = np.zeros((n_queries, classes_k.size))
  
          # a simple ':' index doesn't work right
          for i, idx in enumerate(
              pred_labels.T
          ):  # loop is O(n_neighbors)
              proba_k[all_rows, idx] += weights[:, i]
  
          # normalize 'votes' into real [0,1] probabilities
          normalizer = proba_k.sum(axis=1)[:, np.newaxis]
          normalizer[normalizer == 0.0] = 1.0
          proba_k /= normalizer
  
          probabilities.append(proba_k)
  
      if not self.outputs_2d_:
          probabilities = probabilities[0]
  
      return probabilities
  
file_path: autogluon/tabular/src/autogluon/tabular/models/knn/_knn_loo_variants.py
imports: import logging
  import numpy
  from scipy import stats
  from sklearn.neighbors._base import _get_weights
  from sklearn.utils.extmath import weighted_mode
label_desc: Use image node_id 2 for calling the KNeighborsClassifierLOOMixin obj's underlying member method code with example usage: obj.predict_proba_loo() and returns: probabilities