'Predict class probabilities for X.
The predicted class probabilities of an input sample are computed as
the mean predicted class probabilities of the trees in the forest. The
class probability of a single tree is the fraction of samples of the same
class in a leaf.
Parameters
X : array-like or sparse matrix of shape = [n_samples, n_features]
The input samples. Internally, its dtype will be converted to
``dtype=np.float32``. If a sparse matrix is provided, it will be
converted into a sparse ``csr_matrix``.
Returns
p : array of shape = [n_samples, n_classes], or a list of n_outputs
such arrays if n_outputs > 1.
The class probabilities of the input samples. The order of the
classes corresponds to that in the attribute `classes_`.'

def predict_proba(self, X):

    check_is_fitted(self, 'estimators_')
    X = self._validate_X_predict(X)
    (n_jobs, _, _) = _partition_estimators(self.n_estimators, self.n_jobs)
    all_proba = [np.zeros((X.shape[0], j), dtype=np.float64) for j in np.atleast_1d(self.n_classes_)]
    Parallel(n_jobs=n_jobs, verbose=self.verbose, backend='threading')((delayed(accumulate_prediction)(e.predict_proba, X, all_proba) for e in self.estimators_))
    for proba in all_proba:
        proba /= len(self.estimators_)
    if (len(all_proba) == 1):
        return all_proba[0]
    else:
        return all_proba
