code: def _gbdt_generator(
      data: autogl.data.Data,
      fixlen: int = 1000,
      params: _typing.Mapping[str, _typing.Any] = ...,
      is_val: bool = True,
      train_val_ratio: float = 0.2,
      **optimizer_parameters,
  ) -> _typing.Optional[np.ndarray]:
      parameters: _typing.Dict[str, _typing.Any] = (
          dict(params)
          if (
              params not in (Ellipsis, None)
              and isinstance(params, _typing.Mapping)
          )
          else {
              "boosting_type": "gbdt",
              "verbosity": -1,
              "random_state": 47,
              "objective": "multiclass",
              "metric": ["multi_logloss"],
              "max_bin": 63,
              "save_binary": True,
              "num_threads": 20,
              "num_leaves": 16,
              "subsample": 0.9,
              "subsample_freq": 1,
              "colsample_bytree": 0.8,
              # 'is_training_metric': True,
              # 'metric_freq': 1,
          }
      )
  
      num_classes: int = torch.max(data.y).item() + 1
      parameters["num_class"] = num_classes
      __optimizer_parameters = {
          "num_boost_round": 100,
          "early_stopping_rounds": 5,
          "verbose_eval": False,
      }
      __optimizer_parameters.update(optimizer_parameters)
      if (
          hasattr(data, "train_mask")
          and data.train_mask is not None
          and (
              isinstance(data.train_mask, np.ndarray)
              or isinstance(data.train_mask, torch.Tensor)
          )
      ):
          x: np.ndarray = data.x[data.train_mask].numpy()
          label: np.ndarray = data.y[data.train_mask].numpy()
      else:
          x: np.ndarray = data.x.numpy()
          label: np.ndarray = data.y.numpy()
          is_val: bool = False
      _, num_features = x.shape
      if num_features < fixlen:
          return None
  
      feature_index: np.ndarray = np.array(
          [f"f{i}" for i in range(num_features)]
      )
      if is_val:
          x_train, x_val, y_train, y_val = train_test_split(
              x,
              label,
              test_size=train_val_ratio,
              stratify=label,
              random_state=47,
          )
          dtrain = lightgbm.Dataset(x_train, label=y_train)
          dval = lightgbm.Dataset(x_val, label=y_val)
          clf = lightgbm.train(
              train_set=dtrain,
              params=parameters,
              valid_sets=dval,
              **__optimizer_parameters,
          )
      else:
          train_x = pd.DataFrame(x, columns=feature_index, index=None)
          dtrain = lightgbm.Dataset(train_x, label=label)
          clf = lightgbm.train(
              train_set=dtrain,
              params=parameters,
              **__optimizer_parameters,
          )
  
      imp = np.array(list(clf.feature_importance()))
      return np.argsort(imp)[-fixlen:]
  
file_path: AutoGL/autogl/module/feature/_selectors/_gbdt.py
imports: import numpy
  import pandas
  import torch
  import typing
  import autogl
  from autogl.data.graph import GeneralStaticGraph
  from ..None import _feature_engineer_registry
  import lightgbm
  from sklearn.model_selection import train_test_split
  from ._basic import BaseFeatureSelector
label_desc: Use image node_id 1 for calling a global function with example usage: _gbdt_generator(data, fixlen, params, is_val, train_val_ratio) and returns: np, None