docstr: Predict the class labels for the training data via leave-one-out.
  
  Returns
  -------
  y : ndarray of shape (n_queries,) or (n_queries, n_outputs)
      Class labels for each training data sample.
code: def predict_loo(self):
      """Predict the class labels for the training data via leave-one-out.
  
      Returns
      -------
      y : ndarray of shape (n_queries,) or (n_queries, n_outputs)
          Class labels for each training data sample.
      """
  
      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_outputs = len(classes_)
      n_queries = len(neigh_dist)
      weights = _get_weights(neigh_dist, self.weights)
  
      y_pred = np.empty((n_queries, n_outputs), dtype=classes_[0].dtype)
      for k, classes_k in enumerate(classes_):
          if weights is None:
              mode, _ = stats.mode(_y[neigh_ind, k], axis=1)
          else:
              mode, _ = weighted_mode(_y[neigh_ind, k], weights, axis=1)
  
          mode = np.asarray(mode.ravel(), dtype=np.intp)
          y_pred[:, k] = classes_k.take(mode)
  
      if not self.outputs_2d_:
          y_pred = y_pred.ravel()
  
      return y_pred
  
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 1 for calling the KNeighborsClassifierLOOMixin obj's underlying member method code with example usage: obj.predict_loo() and returns: y_pred