Browse files

COSMIT

  • Loading branch information...
1 parent c1becdc commit d73b24f15f32534576998c67d7479af88fb99893 @GaelVaroquaux GaelVaroquaux committed Dec 29, 2011
Showing with 5 additions and 5 deletions.
  1. +5 −5 sklearn/tree/tree.py
View
10 sklearn/tree/tree.py
@@ -458,15 +458,15 @@ def fit(self, X, y, sample_mask=None, X_argsorted=None):
for node in xrange(self.tree_.node_count):
if (self.tree_.children[node, 0]
- == self.tree_.children[node, 1]
- == Tree.LEAF):
+ == self.tree_.children[node, 1]
+ == Tree.LEAF):
continue
else:
- importances[self.tree_.feature[node]] += \
- self.tree_.n_samples[node] * \
+ importances[self.tree_.feature[node]] += (
+ self.tree_.n_samples[node] *
(self.tree_.init_error[node] -
- self.tree_.best_error[node])
+ self.tree_.best_error[node]))
importances /= np.sum(importances)
self.feature_importances_ = importances

0 comments on commit d73b24f

Please sign in to comment.