8000 FIX `export_text` and `export_graphviz` accepts feature and class names as array-like by Charlie-XIAO · Pull Request #26289 · scikit-learn/scikit-learn · GitHub
[go: up one dir, main page]

Skip to content

FIX export_text and export_graphviz accepts feature and class names as array-like #26289

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
May 15, 2023

Conversation

Charlie-XIAO
Copy link
Contributor

Reference Issues/PRs

Fixes #26265.

What does this implement/fix? Explain your changes.

Make tree.export_text accept both feature names and class names as numpy arrays. Before modification, both tree.export_graphviz and tree.export_text accept can deal with class names which are numpy arrays, but accept only lists during parameter validation. Moreover, tree.export_graphviz can deal with feature names which are numpy arrays, but tree.export_text cannot, and both of them accept only lists during parameter validation.

This fix makes both export_text consistent with export_graphviz, i.e., being able to deal with feature names and class names which are array-like. I will change docstring and parameter validation for export_graphviz in #26034.

Any other comments?

Please let me know if I should add test cases for this.