code: def train_sk_dense(ty, X, y, classification):
      if classification:
          if ty.startswith("skf"):
              d = int(ty.replace("skf", ""))
              f_sk = f_classif
          elif ty.startswith("skmi"):
              d = int(ty.replace("skmi", ""))
              f_sk = mutual_info_classif
      else:
          if ty.startswith("skf"):
              d = int(ty.replace("skf", ""))
              f_sk = f_regression
          elif ty.startswith("skmi"):
              d = int(ty.replace("skmi", ""))
              f_sk = mutual_info_regression
      t = time.time()
      clf = SelectKBest(f_sk, k=d)
      clf.fit_transform(X, y.squeeze())
      ix = np.argsort(-clf.scores_)
      ix = ix[np.where(np.invert(np.isnan(clf.scores_[ix])))[0]][:d]
      t = time.time() - t
      return {"feats": ix, "t": t}
  
file_path: nni/nni/algorithms/feature_engineering/gradient_selector/fgtrain.py
imports: import time
  import numpy
  import torch
  from sklearn.feature_selection import SelectKBest, f_classif, mutual_info_classif, f_regression, mutual_info_regression
  from .None import constants
  from .None import syssettings
  from .learnability import Solver
  from .utils import EMA
label_desc: Use image node_id 5 for calling a global function with example usage: train_sk_dense(ty, X, y, classification) and returns: dict