Guest User

Untitled

a guest
Dec 10th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. from sklearn.ensemble import RandomForestClassifier
  2. estimator = RandomForestClassifier(n_estimators=5, random_state=42)
  3. estimator.fit(X_train, y_train)
  4. for i,e in enumerate(estimator.estimators_):
  5. n_nodes_ = [t.tree_.node_count for t in estimator.estimators_]
  6. children_left_ = [t.tree_.children_left for t in estimator.estimators_]
  7. children_right_ = [t.tree_.children_right for t in estimator.estimators_]
  8. feature_ = [t.tree_.feature for t in estimator.estimators_]
  9. threshold_ = [t.tree_.threshold for t in estimator.estimators_]
Add Comment
Please, Sign In to add comment