Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

ENH: Make forest prediction code more robust to mutations of the esti…

…mators list

This can be useful to quickly study the impact of the size of the forest by
subsampling from it for instance.
  • Loading branch information...
commit 8ad2f5ea8a01a1f33b0acf78bbe7b95c53a6afa4 1 parent 2f998ca
Olivier Grisel ogrisel authored
Showing with 2 additions and 2 deletions.
  1. +2 −2 sklearn/ensemble/
4 sklearn/ensemble/
@@ -472,7 +472,7 @@ def predict_proba(self, X):
for j in xrange(1, len(all_proba)):
proba += all_proba[j]
- proba /= self.n_estimators
+ proba /= len(self.estimators_)
for j in xrange(1, len(all_proba)):
@@ -572,7 +572,7 @@ def predict(self, X):
for i in range(n_jobs))
# Reduce
- y_hat = sum(all_y_hat) / self.n_estimators
+ y_hat = sum(all_y_hat) / len(self.estimators_)
return y_hat
Please sign in to comment.
Something went wrong with that request. Please try again.