docstr: Select Features via a gradient based search on (X, y).
  
  Parameters
  ----------
  X : array-like
      Shape = [n_samples, n_features]
      The training input samples.
  y : array-like
      Shape = [n_samples]
      The target values (class labels in classification, real numbers in
      regression).
  groups : array-like
      Optional, shape = [n_features]
      Groups of columns that must be selected as a unit
      e.g. [0, 0, 1, 2] specifies the first two columns are part of a group.
docstr_tok: ["Select","Features","via","a","gradient","based","search","on","(","X",",","y",")",".","Parameters","--","--","--","--","--","X",":","array-like","Shape","=","[","n_samples",",","n_features","]","The","training","input","samples",".","y",":","array-like","Shape","=","[","n_samples","]","The","target","values","(","class","labels","in","classification",",","real","numbers","in","regression",")",".","groups",":","array-like","Optional",",","shape","=","[","n_features","]","Groups","of","columns","that","must","be","selected","as","a","unit","e.g",".","[","0",",","0",",","1",",","2","]","specifies","the","first","two","columns","are","part","of","a","group","."]
code: def fit(self, X, y, groups=None):
      """
      Select Features via a gradient based search on (X, y).
  
      Parameters
      ----------
      X : array-like
          Shape = [n_samples, n_features]
          The training input samples.
      y : array-like
          Shape = [n_samples]
          The target values (class labels in classification, real numbers in
          regression).
      groups : array-like
          Optional, shape = [n_features]
          Groups of columns that must be selected as a unit
          e.g. [0, 0, 1, 2] specifies the first two columns are part of a group.
      """
      try:
          self._fit(X, y, groups=groups)
      except constants.NanError:
          if self.verbose:
              print("Loss was nan, trying with Doubles")
          torch.set_default_tensor_type(torch.DoubleTensor)
          self._fit(X, y, groups=groups)
      return self
  
imports: import time
  import numpy
  import pandas
  from sklearn.base import BaseEstimator
  from sklearn.feature_selection import SelectorMixin
  from sklearn.utils.validation import check_is_fitted
  import torch
  from nni.feature_engineering.feature_selector import FeatureSelector
  from .None import constants
  from .fginitialize import PrepareData
  from .fgtrain import _train
label_desc: Use image node_id 4 for calling the FeatureGradientSelector obj's underlying member method code with example usage: obj.fit(X, y, groups) and returns: self