def _parallel_build_trees(tree, forest, X, y, sample_weight, tree_idx, n_trees, verbose=0, class_weight=None):
 if (verbose > 1):
  print ('building tree %d of %d' % ((tree_idx + 1), n_trees))
 if forest.bootstrap:
  n_samples = X.shape[0]
  if (sample_weight is None):
   curr_sample_weight = np.ones((n_samples,), dtype=np.float64)
  else:
   curr_sample_weight = sample_weight.copy()
  indices = _generate_sample_indices(tree.random_state, n_samples)
  sample_counts = bincount(indices, minlength=n_samples)
  curr_sample_weight *= sample_counts
  if (class_weight == 'subsample'):
   with warnings.catch_warnings():
    warnings.simplefilter('ignore', DeprecationWarning)
    curr_sample_weight *= compute_sample_weight('auto', y, indices)
  elif (class_weight == 'balanced_subsample'):
   curr_sample_weight *= compute_sample_weight('balanced', y, indices)
  tree.fit(X, y, sample_weight=curr_sample_weight, check_input=False)
 else:
  tree.fit(X, y, sample_weight=sample_weight, check_input=False)
 return tree

def _parallel_build_trees ( tree , forest , X , y , sample_weight , tree_idx , n_trees , verbose = 0 , class_weight = None ) : if ( verbose > 1 ) : print ( 'building tree %d of %d' % ( ( tree_idx + 1 ) , n_trees ) ) if forest . bootstrap : n_samples = X . shape [ 0 ] if ( sample_weight is None ) : curr_sample_weight = np . ones ( ( n_samples , ) , dtype = np . float64 ) else : curr_sample_weight = sample_weight . copy ( ) indices = _generate_sample_indices ( tree . random_state , n_samples ) sample_counts = bincount ( indices , minlength = n_samples ) curr_sample_weight *= sample_counts if ( class_weight == 'subsample' ) : with warnings . catch_warnings ( ) : warnings . simplefilter ( 'ignore' , DeprecationWarning ) curr_sample_weight *= compute_sample_weight ( 'auto' , y , indices ) elif ( class_weight == 'balanced_subsample' ) : curr_sample_weight *= compute_sample_weight ( 'balanced' , y , indices ) tree . fit ( X , y , sample_weight = curr_sample_weight , check_input = False ) else : tree . fit ( X , y , sample_weight = sample_weight , check_input = False ) return tree
private function used to fit a single tree in parallel .