class_docstr: KNearestNeighbors model (scikit-learn): https://scikit-learn.org/stable/modules/generated/sklearn.neighbors.KNeighborsClassifier.html
class_docstr_tok: ["KNearestNeighbors","model","(","scikit-learn",")",":","https",":","\/\/scikit-learn.org\/stable\/modules\/generated\/sklearn.neighbors.KNeighborsClassifier.html"]
code: def _predict_proba_oof(self, X, **kwargs):
      from ._knn_loo_variants import (
          KNeighborsClassifierLOOMixin,
          KNeighborsRegressorLOOMixin,
      )
  
      if self.problem_type in [BINARY, MULTICLASS]:
          y_oof_pred_proba = (
              KNeighborsClassifierLOOMixin.predict_proba_loo(self.model)
          )
      else:
          y_oof_pred_proba = KNeighborsRegressorLOOMixin.predict_loo(
              self.model
          )
      y_oof_pred_proba = self._convert_proba_to_unified_form(
          y_oof_pred_proba
      )
      if X is not None and self._X_unused_index:
          X_unused = X.iloc[self._X_unused_index]
          y_pred_proba_new = self.predict_proba(X_unused)
          X_unused_index = set(self._X_unused_index)
          num_rows = len(X)
          X_used_index = [
              i for i in range(num_rows) if i not in X_unused_index
          ]
          oof_pred_shape = y_oof_pred_proba.shape
          if len(oof_pred_shape) == 1:
              y_oof_tmp = np.zeros(num_rows, dtype=np.float32)
              y_oof_tmp[X_used_index] = y_oof_pred_proba
              y_oof_tmp[self._X_unused_index] = y_pred_proba_new
          else:
              y_oof_tmp = np.zeros(
                  (num_rows, oof_pred_shape[1]), dtype=np.float32
              )
              y_oof_tmp[X_used_index, :] = y_oof_pred_proba
              y_oof_tmp[self._X_unused_index, :] = y_pred_proba_new
          y_oof_pred_proba = y_oof_tmp
      return y_oof_pred_proba
  
imports: import logging
  import math
  import time
  from typing import Dict, Union
  import numpy
  from autogluon.common.features.types import R_FLOAT, R_INT, S_BOOL
  from autogluon.common.utils.resource_utils import ResourceManager
  from autogluon.core.constants import BINARY, MULTICLASS, REGRESSION
  from autogluon.core.models import AbstractModel
  from autogluon.core.utils.exceptions import NotEnoughMemoryError
  from autogluon.core.utils.utils import normalize_pred_probas
label_desc: Use image node_id 13 for calling the KNNModel obj's underlying member method code with example usage: obj._predict_proba_oof(X) and returns: y_oof_pred_proba