# Buggy code
def predict_proba(self, X):
    """Predict class probabilities for X.

    The predicted class probabilities of an input sample is computed as
    the weighted mean predicted class probabilities of the classifiers
    in the ensemble.

    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. DOK and LIL are converted to CSR.

    Returns
    -------
    p : array of shape = [n_samples]
        The class probabilities of the input samples. The order of
        outputs is the same of that of the `classes_` attribute.
    """
    check_is_fitted(self, "n_classes_")

    n_classes = self.n_classes_
    X = self._validate_X_predict(X)

    if self.algorithm == "SAMME.R":
        # The weights are all 1. for SAMME.R
        proba = sum(
            _samme_proba(estimator, n_classes, X) for estimator in self.estimators_
        )
    else:  # self.algorithm == "SAMME"
        proba = sum(
            estimator.predict_proba(X) * w
            for estimator, w in zip(self.estimators_, self.estimator_weights_)
        )

    proba /= self.estimator_weights_.sum()
    proba = np.exp((1.0 / (n_classes - 1)) * proba)
    normalizer = proba.sum(axis=1)[:, np.newaxis]
    normalizer[normalizer == 0.0] = 1.0
    proba /= normalizer

    return proba


# Traceback (ZeroDivisionError)
In [10]: ada.predict_proba(X)
---------------------------------------------------------------------------
ZeroDivisionError                         Traceback (most recent call last)
<ipython-input-10-492c02a5f340> in <module>()
----> 1 ada.predict_proba(X)

/home/feurerm/virtualenvs/2016_epm/lib/python3.4/site-packages/sklearn/ensemble/weight_boosting.py in predict_proba(self, X)
765
766         proba /= self.estimator_weights_.sum()
--> 767         proba = np.exp((1. / (n_classes - 1)) * proba)
768         normalizer = proba.sum(axis=1)[:, np.newaxis]
769         normalizer[normalizer == 0.0] = 1.0

ZeroDivisionError: float division by zero

# Fixed code
def predict_proba(self, X):
    """Predict class probabilities for X.

    The predicted class probabilities of an input sample is computed as
    the weighted mean predicted class probabilities of the classifiers
    in the ensemble.

    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. DOK and LIL are converted to CSR.

    Returns
    -------
    p : array of shape = [n_samples]
        The class probabilities of the input samples. The order of
        outputs is the same of that of the `classes_` attribute.
    """
    check_is_fitted(self, "n_classes_")

    n_classes = self.n_classes_
    X = self._validate_X_predict(X)

    if n_classes == 1:
        return np.ones((X.shape[0], 1))

    if self.algorithm == "SAMME.R":
        # The weights are all 1. for SAMME.R
        proba = sum(
            _samme_proba(estimator, n_classes, X) for estimator in self.estimators_
        )
    else:  # self.algorithm == "SAMME"
        proba = sum(
            estimator.predict_proba(X) * w
            for estimator, w in zip(self.estimators_, self.estimator_weights_)
        )

    proba /= self.estimator_weights_.sum()
    proba = np.exp((1.0 / (n_classes - 1)) * proba)
    normalizer = proba.sum(axis=1)[:, np.newaxis]
    normalizer[normalizer == 0.0] = 1.0
    proba /= normalizer

    return proba