docs: def _parallel_build_estimators(n_estimators, ensemble, X, y, cost_mat,
                                 seeds, verbose):
      """Private function used to build a batch of estimators within a job."""
      # Retrieve settings
      n_samples, n_features = X.shape
      max_samples = ensemble.max_samples
      max_features = ensemble.max_features
  
      if (not isinstance(max_samples, (numbers.Integral, np.integer)) and
              (0.0 < max_samples <= 1.0)):
          max_samples = int(max_samples * n_samples)
  
      if (not isinstance(max_features, (numbers.Integral, np.integer)) and
              (0.0 < max_features <= 1.0)):
          max_features = int(max_features * n_features)
  
      bootstrap = ensemble.bootstrap
      bootstrap_features = ensemble.bootstrap_features
  
      # Build estimators
      estimators = []
      estimators_samples = []
      estimators_features = []
  
      for i in range(n_estimators):
          if verbose > 1:
              print(("building estimator %d of %d" % (i + 1, n_estimators)))
  
          random_state = check_random_state(seeds[i])
          seed = check_random_state(random_state.randint(MAX_INT))
          estimator = ensemble._make_estimator(append=False)
  
          try:  # Not all estimator accept a random_state
              estimator.set_params(random_state=seed)
          except ValueError:
              pass
  
          # Draw features
          if bootstrap_features:
              features = random_state.randint(0, n_features, max_features)
          else:
              features = sample_without_replacement(n_features,
                                                    max_features,
                                                    random_state=random_state)
  
          # Draw samples, using a mask, and then fit
          if bootstrap:
              indices = random_state.randint(0, n_samples, max_samples)
          else:
              indices = sample_without_replacement(n_samples,
                                                   max_samples,
                                                   random_state=random_state)
  
          sample_counts = np.bincount(indices, minlength=n_samples)
  
          estimator.fit((X[indices])[:, features], y[indices], cost_mat[indices, :])
          samples = sample_counts > 0.
  
          estimators.append(estimator)
          estimators_samples.append(samples)
          estimators_features.append(features)
  
      return estimators, estimators_samples, estimators_features