class_docstr: Converts category features to one-hot boolean features by mapping to the category codes.
  
  Parameters
  ----------
  max_levels : int
      The maximum number of categories to use for OHE per feature. Selected categories are based on frequency.
  dtype : number type, default = np.uint8
      Desired dtype of output.
  sparse : bool, default = True
      Will return sparse matrix if set True else will return an array.
  drop : str, default = None
      Refer to OneHotEncoder documentation for details.
class_docstr_tok: ["Converts","category","features","to","one-hot","boolean","features","by","mapping","to","the","category","codes",".","Parameters","--","--","--","--","--","max_levels",":","int","The","maximum","number","of","categories","to","use","for","OHE","per","feature",".","Selected","categories","are","based","on","frequency",".","dtype",":","number","type",",","default","=","np.uint8","Desired","dtype","of","output",".","sparse",":","bool",",","default","=","True","Will","return","sparse","matrix","if","set","True","else","will","return","an","array",".","drop",":","str",",","default","=","None","Refer","to","OneHotEncoder","documentation","for","details","."]
code: def _fit_transform(self, X: DataFrame, **kwargs) -> (DataFrame, dict):
      if self.max_levels is not None:
          self._cat_feat_gen = CatToInt(max_levels=self.max_levels)
          self._cat_feat_gen.fit(X)
          X_out = self._cat_feat_gen.transform(X)
      else:
          X_out = X
  
      self._ohe.fit(X_out)
      self._ohe_columns = self._ohe.get_feature_names_out()
      self._ohe_columns = [
          "_ohe_" + str(i) for i in range(len(self._ohe_columns))
      ]
      X_out = self._transform(X)
  
      features_out = list(X_out.columns)
  
      feature_metadata_out_type_group_map_special = {
          S_BOOL: features_out
      }
      if self.sparse:
          feature_metadata_out_type_group_map_special[
              S_SPARSE
          ] = features_out
      return X_out, feature_metadata_out_type_group_map_special
  
imports: import logging
  import warnings
  import numpy
  import pandas
  from pandas import DataFrame
  from sklearn.preprocessing import OneHotEncoder
  from autogluon.common.features.types import R_CATEGORY, R_INT, S_BOOL, S_SPARSE
  from .abstract import AbstractFeatureGenerator
label_desc: Use image node_id 2 for calling the OneHotEncoderFeatureGenerator obj's underlying member method code with example usage: obj._fit_transform(X) and returns: X_out,  feature_metadata_out_type_group_map_special