Skip to content

Instantly share code, notes, and snippets.

@kbfreder
Created February 11, 2020 22:15
Show Gist options
  • Save kbfreder/81860c3c6eb9990649aca6809dd40c3a to your computer and use it in GitHub Desktop.
Save kbfreder/81860c3c6eb9990649aca6809dd40c3a to your computer and use it in GitHub Desktop.
Retrieve tree depths
# import Random Forest
base_rf = RandomForestClassifier(n_estimators=100, max_depth=None)
base_rf.fit(train_X, train_y)
depths = [est.tree_.max_depth for est in base_rf.estimators_]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment