code: def _learn(self, exclude_double_configurations=True):
      (
          dataset_metafeatures,
          all_other_metafeatures,
      ) = self._split_metafeature_array()
  
      # Remove metafeatures which could not be calculated for the target
      # dataset
      keep = []
      for idx in dataset_metafeatures.index:
          if np.isfinite(dataset_metafeatures.loc[idx]):
              keep.append(idx)
  
      dataset_metafeatures = dataset_metafeatures.loc[keep]
      all_other_metafeatures = all_other_metafeatures.loc[:, keep]
  
      # Do mean imputation of all other metafeatures
      all_other_metafeatures = all_other_metafeatures.fillna(
          all_other_metafeatures.mean()
      )
  
      if self.kND is None:
          # In case that we learn our distance function, get_value the parameters for
          #  the random forest
          if self.distance_kwargs:
              rf_params = ast.literal_eval(self.distance_kwargs)
          else:
              rf_params = None
  
          # To keep the distance the same in every iteration, we create a new
          # random state
          random_state = sklearn.utils.check_random_state(self.seed)
          kND = KNearestDatasets(
              metric=self.distance,
              random_state=random_state,
              logger=self.logger,
              metric_params=rf_params,
          )
  
          runs = dict()
          # TODO move this code to the metabase
          for task_id in all_other_metafeatures.index:
              try:
                  runs[task_id] = self.meta_base.get_runs(task_id)
              except KeyError:
                  # TODO should I really except this?
                  self.logger.info(
                      "Could not find runs for instance %s" % task_id
                  )
                  runs[task_id] = pd.Series(
                      [], name=task_id, dtype=np.float64
                  )
  
          runs = pd.DataFrame(runs)
  
          kND.fit(all_other_metafeatures, runs)
          self.kND = kND
      return self.kND.kBestSuggestions(
          dataset_metafeatures,
          k=-1,
          exclude_double_configurations=exclude_double_configurations,
      )
  
file_path: auto-sklearn/autosklearn/metalearning/optimizers/metalearn_optimizer/metalearner.py
imports: import ast
  import numpy
  import pandas
  import sklearn.utils
  from autosklearn.metalearning.metalearning.kNearestDatasets.kND import KNearestDatasets
label_desc: Use image node_id 4 for calling the MetaLearningOptimizer obj's underlying member method code with example usage: obj._learn(exclude_double_configurations) and returns: self