# Buggy 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


# Traceback (ValueError)
ValueError                                Traceback (most recent call last)
<ipython-input-6-cc5618b5c2ae> in <module>()
9 weights=np.array((1,2))
10 vc = VC(estimators=models, weights=weights)
---> 11 vc.fit(X,y)


142                                  ' tuples')
143
--> 144         if self.weights and len(self.weights) != len(self.estimators):
145             raise ValueError('Number of classifiers and weights must be equal'
146                              '; got %d weights, %d estimators'

ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

# Fixed 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 is not None 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