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"]
docstr: Returns the expected peak memory usage in bytes of the XGBoost model during fit.
  
  The memory usage of XGBoost is primarily made up of two sources:
  
  1. The size of the data
  2. The size of the histogram cache
      Scales roughly by 5120*num_features*2^max_depth bytes
      For 10000 features and 6 max_depth, the histogram would be 3.2 GB.
docstr_tok: ["Returns","the","expected","peak","memory","usage","in","bytes","of","the","XGBoost","model","during","fit",".","The","memory","usage","of","XGBoost","is","primarily","made","up","of","two","sources",":","1",".","The","size","of","the","data","2",".","The","size","of","the","histogram","cache","Scales","roughly","by","5120","*","num_features","*","2^max_depth","bytes","For","10000","features","and","6","max_depth",",","the","histogram","would","be","3.2","GB","."]
code: def _estimate_memory_usage(self, X, **kwargs):
      """
      Returns the expected peak memory usage in bytes of the XGBoost model during fit.
  
      The memory usage of XGBoost is primarily made up of two sources:
  
      1. The size of the data
      2. The size of the histogram cache
          Scales roughly by 5120*num_features*2^max_depth bytes
          For 10000 features and 6 max_depth, the histogram would be 3.2 GB.
      """
      num_classes = (
          self.num_classes if self.num_classes else 1
      )  # self.num_classes could be None after initialization if it's a regression problem
      data_mem_usage = get_approximate_df_mem_usage(X).sum()
      data_mem_usage_bytes = (
          data_mem_usage * 7 + data_mem_usage / 4 * num_classes
      )  # TODO: Extremely crude approximation, can be vastly improved
  
      params = self._get_model_params()
      max_bin = params.get("max_bin", 256)
      max_depth = params.get("max_depth", 6)
      # Formula based on manual testing, aligns with LightGBM histogram sizes
      #  This approximation is less accurate than it is for LightGBM and CatBoost.
      #  Note that max_depth didn't appear to reduce memory usage below 6, and it was unclear if it increased memory usage above 6.
      if max_depth < 7:
          depth_modifier = math.pow(2, 6)
      elif max_depth < 9:
          depth_modifier = math.pow(2, max_depth)
      else:
          depth_modifier = math.pow(2, max_depth - 1)
      histogram_mem_usage_bytes = (
          20 * depth_modifier * len(X.columns) * max_bin
      )
      histogram_mem_usage_bytes *= 1.2  # Add a 20% buffer
  
      approx_mem_size_req = (
          data_mem_usage_bytes + histogram_mem_usage_bytes
      )
      return approx_mem_size_req
  
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 13 for calling the XGBoostModel obj's underlying member method code with example usage: obj._estimate_memory_usage(X) and returns: approx_mem_size_req