class_docstr: Dataset for LOFO
  Parameters
  ----------
  df: pandas dataframe
  target: string
      Column name for target within df
  features: list of strings
      List of column names within df
  feature_groups: dict, optional
      Name, value dictionary of feature groups as numpy.darray or scipy.csr.scr_matrix
  auto_group_threshold: float, optional
      Threshold for grouping correlated features together, must be between 0 and 1
code: def auto_group_features(self, auto_group_threshold):
      if auto_group_threshold == 1.0:
          return [], []
      elif auto_group_threshold == 0.0:
          grouped_features = list(self.features)
          auto_groups = [set(self.features)]
          return grouped_features, auto_groups
      elif 0 < auto_group_threshold < 1:
          feature_matrix = self.df[self.features].values
  
          for i, feature in enumerate(self.features):
              if self.df[feature].dtype.name == "category":
                  feature_series = self.df.groupby(feature)[
                      self.target_name
                  ].transform("mean")
              else:
                  feature_series = self.df[feature]
              feature_matrix[:, i] = (
                  feature_series.fillna(feature_series.mean())
                  .fillna(0)
                  .values
              )
  
          corr_matrix, _ = spearmanr(np.nan_to_num(feature_matrix))
          corr_matrix = np.abs(corr_matrix)
  
          G = nx.Graph()
  
          for i in range(len(self.features)):
              for j in range(i + 1, len(self.features)):
                  if corr_matrix[i, j] > auto_group_threshold:
                      G.add_edge(i, j)
  
          subgraphs = [
              G.subgraph(c) for c in nx.connected_components(G)
          ]
  
          groups = []
          for sg in subgraphs:
              groups.append(
                  [self.features[node] for node in sg.nodes()]
              )
  
          auto_groups = [sorted(g) for g in groups]
          grouped_features = list(
              itertools.chain(*[list(g) for g in groups])
          )
          return grouped_features, auto_groups
      else:
          raise Exception(
              "auto_group_threshold must be between 0 and 1 (inclusive)!"
          )
  
file_path: lofo-importance/lofo/dataset.py
imports: import itertools
  import numpy
  import scipy.sparse
  from scipy.stats import spearmanr
  from lofo.utils import flatten_list
  import networkx
label_desc: Use image node_id 2 for calling the Dataset obj's underlying member method code with example usage: obj.auto_group_features(auto_group_threshold) and returns: list,  list, grouped_features,  auto_groups, grouped_features,  auto_groups