Skip to content

Commit b7d9c3e

Browse files
committed
FIX: ensure that feature importances are properly scaled
1 parent 527ecf5 commit b7d9c3e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

sklearn/ensemble/forest.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,8 @@ def feature_importances_(self):
335335
all_importances = Parallel(n_jobs=self.n_jobs, backend="threading")(
336336
delayed(getattr)(tree, 'feature_importances_')
337337
for tree in self.estimators_)
338-
return sum(all_importances) / self.n_estimators
338+
339+
return sum(all_importances) / len(self.estimators_)
339340

340341

341342
class ForestClassifier(six.with_metaclass(ABCMeta, BaseForest,

0 commit comments

Comments
 (0)