code: def apply_one_hot_encoding(
      X: np.ndarray, one_hot_encoder_map: Dict[int, OneHotEncoder]
  ) -> np.ndarray:
      X = shape_into_2d(X)
  
      if not one_hot_encoder_map:
          return X
  
      one_hot_features = []
  
      for column in range(X.shape[1]):
          if column in one_hot_encoder_map:
              one_hot_features.append(
                  one_hot_encoder_map[column]
                  .transform(X[:, column].reshape(-1, 1))
                  .toarray()
              )
          else:
              one_hot_features.append(X[:, column].reshape(-1, 1))
  
      return np.hstack(one_hot_features).astype(float)
  
imports: import random
  from typing import Dict, Optional, Union
  import numpy
  from scipy.optimize import minimize
  from sklearn.preprocessing import OneHotEncoder
  from dowhy.gcm.util.catboost_encoder import CatBoostEncoder
label_desc: Use image node_id 6 for calling a global function with example usage: apply_one_hot_encoding(X, one_hot_encoder_map) and returns: np, X