class_docstr: Base class for Bagging meta-estimator.
  
  Warning: This class should not be used directly. Use derived classes
  instead.
docstr: Build a Bagging ensemble of estimators from the training
     set (X, y).
  
  Parameters
  ----------
  X : {array-like, sparse matrix} of shape = [n_samples, n_features]
      The training input samples. Sparse matrices are accepted only if
      they are supported by the base estimator.
  
  y : array-like, shape = [n_samples]
      The target values (class labels in classification, real numbers in
      regression).
  
  max_samples : int or float, optional (default=None)
      Argument to use instead of self.max_samples.
  
  max_depth : int, optional (default=None)
      Override value used when constructing base estimator. Only
      supported if the base estimator has a max_depth parameter.
  
  sample_weight : array-like, shape = [n_samples] or None
      Sample weights. If None, then samples are equally weighted.
      Note that this is supported only if the base estimator supports
      sample weighting.
  
  Returns
  -------
  self : object
      Returns self.
docstr_tok: ["Build","a","Bagging","ensemble","of","estimators","from","the","training","set","(","X",",","y",")",".","Parameters","--","--","--","--","--","X",":","{","array-like",",","sparse","matrix","}","of","shape","=","[","n_samples",",","n_features","]","The","training","input","samples",".","Sparse","matrices","are","accepted","only","if","they","are","supported","by","the","base","estimator",".","y",":","array-like",",","shape","=","[","n_samples","]","The","target","values","(","class","labels","in","classification",",","real","numbers","in","regression",")",".","max_samples",":","int","or","float",",","optional","(","default=None",")","Argument","to","use","instead","of","self.max_samples",".","max_depth",":","int",",","optional","(","default=None",")","Override","value","used","when","constructing","base","estimator",".","Only","supported","if","the","base","estimator","has","a","max_depth","parameter",".","sample_weight",":","array-like",",","shape","=","[","n_samples","]","or","None","Sample","weights",".","If","None",",","then","samples","are","equally","weighted",".","Note","that","this","is","supported","only","if","the","base","estimator","supports","sample","weighting",".","Returns","--","--","--","-","self",":","object","Returns","self","."]
code: def _fit(
      self, X, y, max_samples=None, max_depth=None, sample_weight=None
  ):
      """Build a Bagging ensemble of estimators from the training
         set (X, y).
  
      Parameters
      ----------
      X : {array-like, sparse matrix} of shape = [n_samples, n_features]
          The training input samples. Sparse matrices are accepted only if
          they are supported by the base estimator.
  
      y : array-like, shape = [n_samples]
          The target values (class labels in classification, real numbers in
          regression).
  
      max_samples : int or float, optional (default=None)
          Argument to use instead of self.max_samples.
  
      max_depth : int, optional (default=None)
          Override value used when constructing base estimator. Only
          supported if the base estimator has a max_depth parameter.
  
      sample_weight : array-like, shape = [n_samples] or None
          Sample weights. If None, then samples are equally weighted.
          Note that this is supported only if the base estimator supports
          sample weighting.
  
      Returns
      -------
      self : object
          Returns self.
      """
      random_state = check_random_state(self.random_state)
  
      # Convert data
      X, y = check_X_y(X, y, ["csr", "csc"])
  
      # Remap output
      n_samples, self.n_features_ = X.shape
      self._n_samples = n_samples
      y = self._validate_y(y)
  
      # Check parameters
      self._validate_estimator()
  
      if max_depth is not None:
          self.base_estimator_.max_depth = max_depth
  
      # Validate max_samples
      if max_samples is None:
          max_samples = self.max_samples
      elif not isinstance(max_samples, (numbers.Integral, np.integer)):
          max_samples = int(max_samples * X.shape[0])
  
      if not (0 < max_samples <= X.shape[0]):
          raise ValueError("max_samples must be in (0, n_samples]")
  
      # Store validated integer row sampling value
      self._max_samples = max_samples
  
      # Validate max_features
      if isinstance(self.max_features, (numbers.Integral, np.integer)):
          max_features = self.max_features
      else:  # float
          max_features = int(self.max_features * self.n_features_)
  
      if not (0 < max_features <= self.n_features_):
          raise ValueError("max_features must be in (0, n_features]")
  
      # Store validated integer feature sampling value
      self._max_features = max_features
  
      # Other checks
      if not self.bootstrap and self.oob_score:
          raise ValueError(
              "Out of bag estimation only available"
              " if bootstrap=True"
          )
  
      if self.warm_start and self.oob_score:
          raise ValueError(
              "Out of bag estimate only available"
              " if warm_start=False"
          )
  
      if hasattr(self, "oob_score_") and self.warm_start:
          del self.oob_score_
  
      if not self.warm_start or len(self.estimators_) == 0:
          # Free allocated memory, if any
          self.estimators_ = []
          self.estimators_features_ = []
  
      n_more_estimators = self.n_estimators - len(self.estimators_)
  
      if n_more_estimators < 0:
          raise ValueError(
              "n_estimators=%d must be larger or equal to "
              "len(estimators_)=%d when warm_start==True"
              % (self.n_estimators, len(self.estimators_))
          )
  
      elif n_more_estimators == 0:
          warn(
              "Warm-start fitting without increasing n_estimators does not "
              "fit new trees."
          )
          return self
  
      # Parallel loop
      n_jobs, n_estimators, starts = _partition_estimators(
          n_more_estimators, self.n_jobs
      )
      total_n_estimators = sum(n_estimators)
  
      # Advance random state to state after training
      # the first n_estimators
      if self.warm_start and len(self.estimators_) > 0:
          random_state.randint(MAX_INT, size=len(self.estimators_))
  
      seeds = random_state.randint(MAX_INT, size=n_more_estimators)
      self._seeds = seeds
  
      all_results = Parallel(n_jobs=n_jobs, verbose=self.verbose)(
          delayed(_parallel_build_estimators)(
              n_estimators[i],
              self,
              X,
              y,
              sample_weight,
              seeds[starts[i] : starts[i + 1]],
              total_n_estimators,
              verbose=self.verbose,
          )
          for i in range(n_jobs)
      )
  
      # Reduce
      self.estimators_ += list(
          itertools.chain.from_iterable(t[0] for t in all_results)
      )
      self.estimators_features_ += list(
          itertools.chain.from_iterable(t[1] for t in all_results)
      )
  
      if self.oob_score:
          self._set_oob_score(X, y)
  
      return self
  
imports: from __future__ import division
  import itertools
  import numbers
  import numpy
  from warnings import warn
  from abc import ABCMeta, abstractmethod
  from ..base import ClassifierMixin, RegressorMixin
  from ..externals.joblib import Parallel, delayed
  from ..externals.six import with_metaclass
  from ..externals.six.moves import zip
  from ..metrics import r2_score, accuracy_score
  from ..tree import DecisionTreeClassifier, DecisionTreeRegressor
  from ..utils import check_random_state, check_X_y, check_array, column_or_1d
  from ..utils.random import sample_without_replacement
  from ..utils.validation import has_fit_parameter, check_is_fitted
  from ..utils import indices_to_mask
  from ..utils.fixes import bincount
  from ..utils.metaestimators import if_delegate_has_method
  from ..utils.multiclass import check_classification_targets
  from .base import BaseEnsemble, _partition_estimators
label_desc: Use image node_id 3 for calling the BaseBagging obj's underlying member method code with example usage: obj._fit(X, y, max_samples, max_depth, sample_weight) and returns: self, self