Update visualize_decision_tree to include feature names - #1813
Conversation
…yx/evalml into 1757_estimator_input_feature_names
Refactor to add _manage_woodwork() helper function.
Codecov Report
@@ Coverage Diff @@
## main #1813 +/- ##
=========================================
- Coverage 100.0% 100.0% -0.0%
=========================================
Files 252 252
Lines 20061 20052 -9
=========================================
- Hits 20053 20044 -9
Misses 8 8
Continue to review full report at Codecov.
|
| est_class, est_reg = fitted_tree_estimators | ||
|
|
||
| formatted_ = decision_tree_data_from_estimator(est_reg, feature_names=[f'Testing_{col_}' for col_ in range(est_reg._component_obj.n_features_)]) | ||
| formatted_ = decision_tree_data_from_estimator(est_reg) |
There was a problem hiding this comment.
Removing feature names parameter. Since this test already checks that the output has the feature names but now we're just grabbing them from the estimator rather than setting explicitly, no other code changes needed.
jeremyliweishih
left a comment
There was a problem hiding this comment.
LGTM. Only comment I have is maybe we can make the feature names stand out a bit (bold or italicize it?).
|
@jeremyliweishih That's a great suggestion! With our current implementation though, I'm not sure there's an API available to easily do this though so we might need to punt on that: https://scikit-learn.org/stable/modules/generated/sklearn.tree.export_graphviz.html#sklearn.tree.export_graphviz |
Closes #1718. Also removes
feature_namesas a parameter fromdecision_tree_data_from_estimator, since we can extract the feature names used to fit from the estimator now.Not sure what the best way to add testing to our codebase to ensure the output png has the right name, but here's a code snippet and the resulting image 😁