code: def _restore_base_estimators(self, kernel_cache, out, X, cv):
          
          train_folds = {fold: train_index for fold, (train_index, _) in enumerate(cv)}
  
          for idx, fold, _, est in out:
              if idx in kernel_cache:
                  if not hasattr(est, 'fit_X_'):
                      raise ValueError(
                          'estimator %s uses a custom kernel function, '
                          'but does not have the attribute `fit_X_` after training' % self.base_estimators[idx][0])
  
                  est.set_params(kernel=self.base_estimators[idx][1].kernel)
                  est.fit_X_ = X[train_folds[fold]]
  
          return out
docs: Restore custom kernel functions of estimators for predictions