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

    The predicted class probabilities of an input sample is computed as
    the mean predicted class probabilities of the base estimators in the
    ensemble. If base estimators do not implement a ``predict_proba``
    method, then it resorts to voting and the predicted class probabilities
    of a an input sample represents the proportion of estimators predicting
    each class.

    Parameters
    ----------
    X : array-like of shape = [n_samples, n_features]
        The input samples.

    Returns
    -------
    p : array of shape = [n_samples, n_classes]
        The class probabilities of the input samples. The order of the
        classes corresponds to that in the attribute `classes_`.
    """
    # Check data
    (X,) = check_arrays(X)

    if self.n_features_ != X.shape[1]:
        raise ValueError(
            "Number of features of the model must "
            "match the input. Model n_features is {0} and "
            "input n_features is {1}."
            "".format(self.n_features_, X.shape[1])
        )

    # Parallel loop
    n_jobs, n_estimators, starts = _partition_estimators(self)

    all_proba = Parallel(n_jobs=n_jobs, verbose=self.verbose)(
        delayed(_parallel_predict_proba)(
            self.estimators_[starts[i] : starts[i + 1]],
            self.estimators_features_[starts[i] : starts[i + 1]],
            X,
            self.n_classes_,
        )
        for i in range(n_jobs)
    )

    # Reduce
    proba = sum(all_proba) / self.n_estimators

    return proba


# Traceback (IndexError)
======================================================================
ERROR: sklearn.tests.test_common.test_regressors_train('RANSACRegressor', <class 'sklearn.linear_model.ransac.RANSACRegr
essor'>, array([[-0.44836249, -0.47282444, -1.20608008, ..., -0.75500806,
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Python27\lib\site-packages\nose\case.py", line 197, in runTest
self.test(*self.arg)
File "C:\Python27\lib\site-packages\sklearn\tests\test_common.py", line 850, in check_regressors_train
assert_raises(ValueError, regressor.fit, X, y[:-1])
File "C:\Python27\lib\unittest\case.py", line 473, in assertRaises
callableObj(*args, **kwargs)
File "C:\Python27\lib\site-packages\sklearn\linear_model\ransac.py", line 261, in fit
y_subset = y[subset_idxs]
IndexError: index 199 is out of bounds for axis 0 with size 199

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

    The predicted class probabilities of an input sample is computed as
    the mean predicted class probabilities of the base estimators in the
    ensemble. If base estimators do not implement a ``predict_proba``
    method, then it resorts to voting and the predicted class probabilities
    of a an input sample represents the proportion of estimators predicting
    each class.

    Parameters
    ----------
    X : {array-like, sparse matrix} of shape = [n_samples, n_features]
        The training input samples. Sparse matrices are accepted only if
        they are supported by the base estimator.

    Returns
    -------
    p : array of shape = [n_samples, n_classes]
        The class probabilities of the input samples. The order of the
        classes corresponds to that in the attribute `classes_`.
    """
    # Check data
    (X,) = check_arrays(X)

    if self.n_features_ != X.shape[1]:
        raise ValueError(
            "Number of features of the model must "
            "match the input. Model n_features is {0} and "
            "input n_features is {1}."
            "".format(self.n_features_, X.shape[1])
        )

    # Parallel loop
    n_jobs, n_estimators, starts = _partition_estimators(self)

    all_proba = Parallel(n_jobs=n_jobs, verbose=self.verbose)(
        delayed(_parallel_predict_proba)(
            self.estimators_[starts[i] : starts[i + 1]],
            self.estimators_features_[starts[i] : starts[i + 1]],
            X,
            self.n_classes_,
        )
        for i in range(n_jobs)
    )

    # Reduce
    proba = sum(all_proba) / self.n_estimators

    return proba