class_docstr: XGBoost model: https://xgboost.readthedocs.io/en/latest/
  
  Hyperparameter options: https://xgboost.readthedocs.io/en/latest/parameter.html
class_docstr_tok: ["XGBoost","model",":","https",":","\/\/xgboost.readthedocs.io\/en\/latest\/","Hyperparameter","options",":","https",":","\/\/xgboost.readthedocs.io\/en\/latest\/parameter.html"]
code: def _get_num_classes(self, y):
      if self.problem_type == MULTICLASS:
          if self.num_classes is not None:
              num_classes = self.num_classes
          else:
              num_classes = 10  # Guess if not given, can do better by looking at y
      elif (
          self.problem_type == SOFTCLASS
      ):  # TODO: delete this elif if it's unnecessary.
          num_classes = y.shape[1]
      else:
          num_classes = 1
      return num_classes
  
imports: import logging
  import math
  import os
  import time
  from autogluon.common.features.types import R_BOOL, R_CATEGORY, R_FLOAT, R_INT
  from autogluon.common.utils.lite import disable_if_lite_mode
  from autogluon.common.utils.pandas_utils import get_approximate_df_mem_usage
  from autogluon.common.utils.resource_utils import ResourceManager
  from autogluon.common.utils.try_import import try_import_xgboost
  from autogluon.core.constants import BINARY, MULTICLASS, PROBLEM_TYPES_CLASSIFICATION, REGRESSION, SOFTCLASS
  from autogluon.core.models import AbstractModel
  from autogluon.core.models._utils import get_early_stopping_rounds
  from .None import xgboost_utils
  from .hyperparameters.parameters import get_param_baseline
  from .hyperparameters.searchspaces import get_default_searchspace
label_desc: Use image node_id 11 for calling the XGBoostModel obj's underlying member method code with example usage: obj._get_num_classes(y) and returns: num_classes