class_docstr: Encode categorical features as an integer array.
  
  The input to this transformer should be an array-like of integers or
  strings, denoting the values taken on by categorical (discrete) features.
  The features are converted to ordinal integers. This results in
  a single column of integers (0 to n_categories - 1) per feature.
  
  Read more in the :ref:`User Guide <preprocessing_categorical_features>`.
  
  Parameters
  ----------
  categories : 'auto' or a list of lists/arrays of values.
      Categories (unique values) per feature:
  
      - 'auto' : Determine categories automatically from the training data.
      - list : ``categories[i]`` holds the categories expected in the ith
        column. The passed categories should not mix strings and numeric
        values, and should be sorted in case of numeric values.
  
      The used categories can be found in the ``categories_`` attribute.
  
  dtype : number type, default np.float64
      Desired dtype of output.
  
  max_levels : int, default=None
      One less than the maximum number of categories to keep (max_levels = 2 means we keep 3 distinct categories).
      Infrequent categories are grouped together and mapped to the highest int
      Unknown categories encountered at test time are mapped to another extra category. Embedding layers should be able to take in max_levels + 1 categories!
  
  Attributes
  ----------
  categories_ : list of arrays
      The categories of each feature determined during fitting
      (in order of the features in X and corresponding with the output
      of ``transform``).
  
  infrequent_indices_: list of arrays of shape(n_infrequent_categories)
      ``infrequent_indices_[i]`` contains a list of indices in
      ``categories_[i]`` corresponding to the infrequent categories.
docstr: Transform X to ordinal codes.
  
  Parameters
  ----------
  X : array-like, shape [n_samples, n_features]
      The data to encode.
  
  Returns
  -------
  X_out : sparse matrix or a 2-d array
      Transformed input.
docstr_tok: ["Transform","X","to","ordinal","codes",".","Parameters","--","--","--","--","--","X",":","array-like",",","shape","[","n_samples",",","n_features","]","The","data","to","encode",".","Returns","--","--","--","-","X_out",":","sparse","matrix","or","a","2-d","array","Transformed","input","."]
code: def transform(self, X):
      """Transform X to ordinal codes.
  
      Parameters
      ----------
      X : array-like, shape [n_samples, n_features]
          The data to encode.
  
      Returns
      -------
      X_out : sparse matrix or a 2-d array
          Transformed input.
  
      """
      X = self._label_encoder.transform(X)
      X_og_array = np.array(X)  # original X array before transform
      X_int, _ = self._transform(
          X, handle_unknown="ignore"
      )  # will contain zeros for 0th category as well as unknown values.
  
      for i in range(X_int.shape[1]):
          X_col_data = X_og_array[:, i]
          cat_set = self.categories_as_sets_[i]
          unknown_elements = np.isin(X_col_data, cat_set, invert=True)
          X_int[unknown_elements, i] = self.categories_unknown_level_[
              i
          ]  # replace entries with unknown categories with feature_i_numlevels + 1 value. Do NOT modify self.categories_
  
      return X_int.astype(self.dtype, copy=False)
  
imports: import copy
  from numbers import Integral
  import numpy
  from scipy import sparse
  from sklearn.base import BaseEstimator, TransformerMixin
  from sklearn.utils import check_array
  from sklearn.utils.validation import check_is_fitted
  from autogluon.features.generators import LabelEncoderFeatureGenerator
label_desc: Use image node_id 3 for calling the OrdinalMergeRaresHandleUnknownEncoder obj's underlying member method code with example usage: obj.transform(X) and returns: X_int