class_docstr: Soft Voting/Majority Rule classifier for unfitted estimators.
  
  .. versionadded:: 0.17
  
  Read more in the :ref:`User Guide <voting_classifier>`.
  
  Parameters
  ----------
  estimators : list of (string, estimator) tuples
      Invoking the ``fit`` method on the ``VotingClassifier`` will fit clones
      of those original estimators that will be stored in the class attribute
      `self.estimators_`.
  
  voting : str, {'hard', 'soft'} (default='hard')
      If 'hard', uses predicted class labels for majority rule voting.
      Else if 'soft', predicts the class label based on the argmax of
      the sums of the predicted probabilities, which is recommended for
      an ensemble of well-calibrated classifiers.
  
  weights : array-like, shape = [n_classifiers], optional (default=`None`)
      Sequence of weights (`float` or `int`) to weight the occurrences of
      predicted class labels (`hard` voting) or class probabilities
      before averaging (`soft` voting). Uses uniform weights if `None`.
  
  n_jobs : int, optional (default=1)
      The number of jobs to run in parallel for ``fit``.
      If -1, then the number of jobs is set to the number of cores.
  
  Attributes
  ----------
  estimators_ : list of classifiers
      The collection of fitted sub-estimators.
  
  classes_ : array-like, shape = [n_predictions]
      The classes labels.
  
  Examples
  --------
  >>> import numpy as np
  >>> from sklearn.linear_model import LogisticRegression
  >>> from sklearn.naive_bayes import GaussianNB
  >>> from sklearn.ensemble import RandomForestClassifier, VotingClassifier
  >>> clf1 = LogisticRegression(random_state=1)
  >>> clf2 = RandomForestClassifier(random_state=1)
  >>> clf3 = GaussianNB()
  >>> X = np.array([[-1, -1], [-2, -1], [-3, -2], [1, 1], [2, 1], [3, 2]])
  >>> y = np.array([1, 1, 1, 2, 2, 2])
  >>> eclf1 = VotingClassifier(estimators=[
  ...         ('lr', clf1), ('rf', clf2), ('gnb', clf3)], voting='hard')
  >>> eclf1 = eclf1.fit(X, y)
  >>> print(eclf1.predict(X))
  [1 1 1 2 2 2]
  >>> eclf2 = VotingClassifier(estimators=[
  ...         ('lr', clf1), ('rf', clf2), ('gnb', clf3)],
  ...         voting='soft')
  >>> eclf2 = eclf2.fit(X, y)
  >>> print(eclf2.predict(X))
  [1 1 1 2 2 2]
  >>> eclf3 = VotingClassifier(estimators=[
  ...        ('lr', clf1), ('rf', clf2), ('gnb', clf3)],
  ...        voting='soft', weights=[2,1,1])
  >>> eclf3 = eclf3.fit(X, y)
  >>> print(eclf3.predict(X))
  [1 1 1 2 2 2]
  >>>
docstr: 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
docstr_tok: ["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"]
code: 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
  
imports: import numpy
  from ..base import BaseEstimator
  from ..base import ClassifierMixin
  from ..base import TransformerMixin
  from ..base import clone
  from ..preprocessing import LabelEncoder
  from ..externals import six
  from ..externals.joblib import Parallel, delayed
  from ..utils.validation import has_fit_parameter, check_is_fitted
label_desc: Use image node_id 2 for calling the VotingClassifier obj's underlying member method code with example usage: obj.fit(X, y, sample_weight) and returns: self