class_docstr: Base class for AdaBoost estimators.
  
  Warning: This class should not be used directly. Use derived classes
  instead.
class_docstr_tok: ["Base","class","for","AdaBoost","estimators",".","Warning",":","This","class","should","not","be","used","directly",".","Use","derived","classes","instead","."]
docstr: Build a boosted classifier/regressor from the training set (X, y).
  
  Parameters
  ----------
  X : {array-like, sparse matrix} of shape = [n_samples, n_features]
      The training input samples. Sparse matrix can be CSC, CSR, COO,
      DOK, or LIL. COO, DOK, and LIL are converted to CSR. The dtype is
      forced to DTYPE from tree._tree if the base classifier of this
      ensemble weighted boosting classifier is a tree or forest.
  
  y : array-like of shape = [n_samples]
      The target values (class labels in classification, real numbers in
      regression).
  
  sample_weight : array-like of shape = [n_samples], optional
      Sample weights. If None, the sample weights are initialized to
      1 / n_samples.
  
  Returns
  -------
  self : object
      Returns self.
docstr_tok: ["Build","a","boosted","classifier\/regressor","from","the","training","set","(","X",",","y",")",".","Parameters","--","--","--","--","--","X",":","{","array-like",",","sparse","matrix","}","of","shape","=","[","n_samples",",","n_features","]","The","training","input","samples",".","Sparse","matrix","can","be","CSC",",","CSR",",","COO",",","DOK",",","or","LIL",".","COO",",","DOK",",","and","LIL","are","converted","to","CSR",".","The","dtype","is","forced","to","DTYPE","from","tree._tree","if","the","base","classifier","of","this","ensemble","weighted","boosting","classifier","is","a","tree","or","forest",".","y",":","array-like","of","shape","=","[","n_samples","]","The","target","values","(","class","labels","in","classification",",","real","numbers","in","regression",")",".","sample_weight",":","array-like","of","shape","=","[","n_samples","]",",","optional","Sample","weights",".","If","None",",","the","sample","weights","are","initialized","to","1","\/","n_samples",".","Returns","--","--","--","-","self",":","object","Returns","self","."]
code: def fit(self, X, y, sample_weight=None):
      """Build a boosted classifier/regressor from the training set (X, y).
  
      Parameters
      ----------
      X : {array-like, sparse matrix} of shape = [n_samples, n_features]
          The training input samples. Sparse matrix can be CSC, CSR, COO,
          DOK, or LIL. COO, DOK, and LIL are converted to CSR. The dtype is
          forced to DTYPE from tree._tree if the base classifier of this
          ensemble weighted boosting classifier is a tree or forest.
  
      y : array-like of shape = [n_samples]
          The target values (class labels in classification, real numbers in
          regression).
  
      sample_weight : array-like of shape = [n_samples], optional
          Sample weights. If None, the sample weights are initialized to
          1 / n_samples.
  
      Returns
      -------
      self : object
          Returns self.
      """
      # Check parameters
      if self.learning_rate <= 0:
          raise ValueError("learning_rate must be greater than zero")
  
      if self.base_estimator is None or isinstance(
          self.base_estimator, (BaseDecisionTree, BaseForest)
      ):
          dtype = DTYPE
          accept_sparse = "csc"
      else:
          dtype = None
          accept_sparse = ["csr", "csc"]
  
      X, y = check_X_y(
          X,
          y,
          accept_sparse=accept_sparse,
          dtype=dtype,
          y_numeric=is_regressor(self),
      )
  
      if sample_weight is None:
          # Initialize weights to 1 / n_samples
          sample_weight = np.empty(X.shape[0], dtype=np.float64)
          sample_weight[:] = 1.0 / X.shape[0]
      else:
          # Normalize existing weights
          sample_weight = sample_weight / sample_weight.sum(
              dtype=np.float64
          )
  
          # Check that the sample weights sum is positive
          if sample_weight.sum() <= 0:
              raise ValueError(
                  "Attempting to fit with a non-positive "
                  "weighted number of samples."
              )
  
      # Check parameters
      self._validate_estimator()
  
      # Clear any previous fit results
      self.estimators_ = []
      self.estimator_weights_ = np.zeros(
          self.n_estimators, dtype=np.float64
      )
      self.estimator_errors_ = np.ones(
          self.n_estimators, dtype=np.float64
      )
  
      random_state = check_random_state(self.random_state)
  
      for iboost in range(self.n_estimators):
          # Boosting step
          (
              sample_weight,
              estimator_weight,
              estimator_error,
          ) = self._boost(iboost, X, y, sample_weight, random_state)
  
          # Early termination
          if sample_weight is None:
              break
  
          self.estimator_weights_[iboost] = estimator_weight
          self.estimator_errors_[iboost] = estimator_error
  
          # Stop if error is zero
          if estimator_error == 0:
              break
  
          sample_weight_sum = np.sum(sample_weight)
  
          # Stop if the sum of sample weights has become non-positive
          if sample_weight_sum <= 0:
              break
  
          if iboost < self.n_estimators - 1:
              # Normalize
              sample_weight /= sample_weight_sum
  
      return self
  
imports: from abc import ABCMeta, abstractmethod
  import numpy
  from numpy.core.umath_tests import inner1d
  from .base import BaseEnsemble
  from ..base import ClassifierMixin, RegressorMixin, is_regressor
  from ..externals import six
  from ..externals.six.moves import zip
  from ..externals.six.moves import xrange
  from .forest import BaseForest
  from ..tree import DecisionTreeClassifier, DecisionTreeRegressor
  from ..tree.tree import BaseDecisionTree
  from ..tree._tree import DTYPE
  from ..utils import check_array, check_X_y, check_random_state
  from ..metrics import accuracy_score, r2_score
  from sklearn.utils.validation import has_fit_parameter, check_is_fitted
label_desc: Use image node_id 2 for calling the BaseWeightBoosting obj's underlying member method code with example usage: obj.fit(X, y, sample_weight) and returns: self