code: def fit(self, X, y=None):
      self.cat_cols = list(X.select_dtypes(include="category").columns)
      self.other_cols = list(
          X.select_dtypes(exclude="category").columns
      )
      self.ohe_encs = OneHotMergeRaresHandleUnknownEncoder(
          max_levels=self.max_levels
      )
  
      if self.cat_cols:
          self.ohe_encs.fit(X[self.cat_cols])
          assert len(self.cat_cols) == len(self.ohe_encs.categories_)
  
          for cat_col, categories in zip(
              self.cat_cols, self.ohe_encs.categories_
          ):
              categories_ = categories.tolist()
              self.labels[cat_col] = categories_
              # Update feature map ({name: type})
              for category in categories_:
                  self._feature_map[
                      f"{cat_col}_{category}"
                  ] = "i"  # one-hot encoding data type is boolean
  
      if self.other_cols:
          for c in self.other_cols:
              self._feature_map[c] = (
                  "int" if X[c].dtypes == int else "float"
              )
      return self
  
file_path: autogluon/tabular/src/autogluon/tabular/models/xgboost/xgboost_utils.py
imports: from collections import OrderedDict
  import numpy
  from scipy.sparse import csr_matrix, hstack
  from sklearn.base import BaseEstimator, TransformerMixin
  from autogluon.core.constants import BINARY, MULTICLASS, REGRESSION, SOFTCLASS
  from ..tabular_nn.utils.categorical_encoders import OneHotMergeRaresHandleUnknownEncoder
label_desc: Use image node_id 2 for calling the OheFeatureGenerator obj's underlying member method code with example usage: obj.fit(X, y) and returns: self