code: def preprocess_random_forest(dataset, log):
      """
      For random forest:
      - Do nothing for numerical features except null imputation.
      - For categorical features, use ordinal encoding to map them into integers.
      """
      cat_columns, num_columns = [], []
      shift_amount = 0
      for i, f in enumerate(dataset.features):
          if f.is_target:
              shift_amount += 1
              continue
          elif f.is_categorical():
              cat_columns.append(i - shift_amount)
          else:
              num_columns.append(i - shift_amount)
  
      cat_pipeline = Pipeline(
          [
              ("imputer", SimpleImputer(strategy="most_frequent")),
              ("ordinal_encoder", OrdinalEncoder()),
          ]
      )
  
      num_pipeline = Pipeline(
          [
              ("imputer", SimpleImputer(strategy="mean")),
          ]
      )
  
      data_pipeline = ColumnTransformer(
          [
              ("categorical", cat_pipeline, cat_columns),
              ("numerical", num_pipeline, num_columns),
          ]
      )
  
      data_pipeline.fit(
          np.concatenate([dataset.train.X, dataset.test.X], axis=0)
      )
  
      X_train = data_pipeline.transform(dataset.train.X)
      X_test = data_pipeline.transform(dataset.test.X)
  
      return X_train, X_test
  
file_path: nni/examples/trials/benchmarking/automlbenchmark/nni/extensions/NNI/architectures/run_random_forest.py
imports: import logging
  import sklearn
  import time
  import numpy
  from sklearn.impute import SimpleImputer
  from sklearn.compose import ColumnTransformer
  from sklearn.preprocessing import OrdinalEncoder
  from sklearn.pipeline import Pipeline
  from sklearn.ensemble import RandomForestClassifier, RandomForestRegressor
  from sklearn.model_selection import cross_val_score
  from amlb.benchmark import TaskConfig
  from amlb.data import Dataset
  from amlb.datautils import impute
  from amlb.utils import Timer
  from amlb.results import save_predictions_to_file
label_desc: Use image node_id 1 for calling a global function with example usage: preprocess_random_forest(dataset, log) and returns: X_train,  X_test