code: def get_init(
      data_train,
      init_type="on",
      rng=np.random.RandomState(0),
      prev_score=None,
  ):
      """
      Initialize the 'x' variable with different settings
      """
  
      D = data_train.n_features
      value_off = constants.Initialization.VALUE_DICT[
          constants.Initialization.OFF
      ]
      value_on = constants.Initialization.VALUE_DICT[
          constants.Initialization.ON
      ]
  
      if prev_score is not None:
          x0 = prev_score
      elif not isinstance(init_type, str):
          x0 = value_off * np.ones(D)
          x0[init_type] = value_on
      elif init_type.startswith(constants.Initialization.RANDOM):
          d = int(
              init_type.replace(constants.Initialization.RANDOM, "")
          )
          x0 = value_off * np.ones(D)
          x0[rng.permutation(D)[:d]] = value_on
      elif init_type == constants.Initialization.SKLEARN:
          B = data_train.return_raw
          X, y = data_train.get_dense_data()
          data_train.set_return_raw(B)
          ix = train_sk_dense(
              init_type, X, y, data_train.classification
          )
          x0 = value_off * np.ones(D)
          x0[ix] = value_on
      elif init_type in constants.Initialization.VALUE_DICT:
          x0 = constants.Initialization.VALUE_DICT[init_type] * np.ones(
              D
          )
      else:
          raise NotImplementedError(
              "init_type {0} not supported yet".format(init_type)
          )
      # pylint: disable=E1102
      return torch.tensor(
          x0.reshape((-1, 1)), dtype=torch.get_default_dtype()
      )
  
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 2 for calling a global function with example usage: get_init(data_train, init_type, rng, prev_score) and returns: torch