parameters: (self, X, y, sample_weight=None)
return_statement: return self
docstring: Fit the estimators.
  
          Parameters
          ----------
          X : {array-like, sparse matrix}, shape = [n_samples, n_features]
              Training vectors, where n_samples is the number of samples and
              n_features is the number of features.
  
          y : array-like, shape = [n_samples]
              Target values.
  
          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 all underlying estimators
              support sample weights.
  
          Returns
          -------
          self : object
docstring_summary: Fit the estimators.
docstring_tokens: Fit the estimators .
function: def fit(self, X, y, sample_weight=None):
          """ Fit the estimators.
  
          Parameters
          ----------
          X : {array-like, sparse matrix}, shape = [n_samples, n_features]
              Training vectors, where n_samples is the number of samples and
              n_features is the number of features.
  
          y : array-like, shape = [n_samples]
              Target values.
  
          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 all underlying estimators
              support sample weights.
  
          Returns
          -------
          self : object
          """
          if isinstance(y, np.ndarray) and len(y.shape) > 1 and y.shape[1] > 1:
              raise NotImplementedError('Multilabel and multi-output'
                                        ' classification is not supported.')
  
          if self.voting not in ('soft', 'hard'):
              raise ValueError("Voting must be 'soft' or 'hard'; got (voting=%r)"
                               % self.voting)
  
          if self.estimators is None or len(self.estimators) == 0:
              raise AttributeError('Invalid `estimators` attribute, `estimators`'
                                   ' should be a list of (string, estimator)'
                                   ' tuples')
  
          if self.weights and len(self.weights) != len(self.estimators):
              raise ValueError('Number of classifiers and weights must be equal'
                               '; got %d weights, %d estimators'
                               % (len(self.weights), len(self.estimators)))
  
          if sample_weight is not None:
              for name, step in self.estimators:
                  if not has_fit_parameter(step, 'sample_weight'):
                      raise ValueError('Underlying estimator \'%s\' does not support'
                                       ' sample weights.' % name)
  
          self.le_ = LabelEncoder()
          self.le_.fit(y)
          self.classes_ = self.le_.classes_
          self.estimators_ = []
  
          transformed_y = self.le_.transform(y)
  
          self.estimators_ = Parallel(n_jobs=self.n_jobs)(
                  delayed(_parallel_fit_estimator)(clone(clf), X, transformed_y,
                      sample_weight)
                      for _, clf in self.estimators)
  
          return self
function_tokens: def fit ( self , X , y , sample_weight = None ) : if isinstance ( y , np . ndarray ) and len ( y . shape ) > 1 and y . shape [ 1 ] > 1 : raise NotImplementedError ( 'Multilabel and multi-output' ' classification is not supported.' ) if self . voting not in ( 'soft' , 'hard' ) : raise ValueError ( "Voting must be 'soft' or 'hard'; got (voting=%r)" % self . voting ) if self . estimators is None or len ( self . estimators ) == 0 : raise AttributeError ( 'Invalid `estimators` attribute, `estimators`' ' should be a list of (string, estimator)' ' tuples' ) if self . weights and len ( self . weights ) != len ( self . estimators ) : raise ValueError ( 'Number of classifiers and weights must be equal' '; got %d weights, %d estimators' % ( len ( self . weights ) , len ( self . estimators ) ) ) if sample_weight is not None : for name , step in self . estimators : if not has_fit_parameter ( step , 'sample_weight' ) : raise ValueError ( 'Underlying estimator \'%s\' does not support' ' sample weights.' % name ) self . le_ = LabelEncoder ( ) self . le_ . fit ( y ) self . classes_ = self . le_ . classes_ self . estimators_ = [ ] transformed_y = self . le_ . transform ( y ) self . estimators_ = Parallel ( n_jobs = self . n_jobs ) ( delayed ( _parallel_fit_estimator ) ( clone ( clf ) , X , transformed_y , sample_weight ) for _ , clf in self . estimators ) return self