Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from sklearn.ensemble import RandomForestClassifier
- estimator = RandomForestClassifier(n_estimators=5, random_state=42)
- estimator.fit(X_train, y_train)
- for i,e in enumerate(estimator.estimators_):
- n_nodes_ = [t.tree_.node_count for t in estimator.estimators_]
- children_left_ = [t.tree_.children_left for t in estimator.estimators_]
- children_right_ = [t.tree_.children_right for t in estimator.estimators_]
- feature_ = [t.tree_.feature for t in estimator.estimators_]
- threshold_ = [t.tree_.threshold for t in estimator.estimators_]
Add Comment
Please, Sign In to add comment