code: def encode_cat_features(
      X, y, cat_features, train_mask, val_mask, test_mask
  ):
      enc = CatBoostEncoder()
      A = X.to_numpy(copy=True)
      b = y.to_numpy(copy=True)
      A[np.ix_(train_mask, cat_features)] = enc.fit_transform(
          A[np.ix_(train_mask, cat_features)], b[train_mask]
      )
      A[np.ix_(val_mask + test_mask, cat_features)] = enc.transform(
          A[np.ix_(val_mask + test_mask, cat_features)]
      )
      A = A.astype(float)
      return pd.DataFrame(A, columns=X.columns)
  
file_path: dgl/examples/pytorch/bgnn/run.py
imports: import json
  import os
  import numpy
  import pandas
  import torch
  import torch.nn.functional
  from BGNN import BGNNPredictor
  from category_encoders import CatBoostEncoder
  from dgl.data.utils import load_graphs
  from dgl.nn.pytorch import AGNNConv, APPNPConv, ChebConv, GATConv, GraphConv
  from sklearn import preprocessing
  from torch.nn import Dropout, ELU, Linear, ReLU, Sequential
label_desc: Use image node_id 4 for calling a global function with example usage: encode_cat_features(X, y, cat_features, train_mask, val_mask, test_mask) and returns: pd