Repository navigation
MNT Deprecate multiclass_colors in favour of label_colors in DecisionBoundaryDisplay - #34092
Conversation
| Imported `matplotlib` module. | ||
|
|
||
| multiclass_colors : str or list of matplotlib colors, default=None | ||
| label_colors : str or list of matplotlib colors, default=None |
There was a problem hiding this comment.
Since this is a private function, this can be renamed without a deprecation here, right?
| ('viridis') is used. | ||
|
|
||
| .. versionadded:: 1.7 | ||
| .. versionchanged:: 1.9 |
There was a problem hiding this comment.
What should happen with this versionchanged note? Will it simply be removed in 1.12 or should it be preserved in label_colors?
There was a problem hiding this comment.
Interesting point. I would lean towards removing it in 1.12, to keep the docstring cleaner - we have some very long parameter docstrings with 4+ note entries, some from very old (<v0.20) versions.
Its documented in the changelog, if someone really wanted to dig.
lucyleeow
left a comment
There was a problem hiding this comment.
but now I'm not sure if something more generic like plot_colors would actually be better given that we also support regression. WDYT?
Good point. What about target_colors ?
| ('viridis') is used. | ||
|
|
||
| .. versionadded:: 1.7 | ||
| .. versionchanged:: 1.9 |
There was a problem hiding this comment.
Interesting point. I would lean towards removing it in 1.12, to keep the docstring cleaner - we have some very long parameter docstrings with 4+ note entries, some from very old (<v0.20) versions.
Its documented in the changelog, if someone really wanted to dig.
| .. versionadded:: 1.10 | ||
| `multiclass_colors` was renamed to `target_colors` | ||
|
|
||
| multiclass_colors : str or list of matplotlib colors, default=None |
There was a problem hiding this comment.
This can be moved to the end as well
| class_of_interest=None, | ||
| multiclass_colors=None, | ||
| target_colors=None, | ||
| multiclass_colors="deprecated", # TODO(1.12): remove |
There was a problem hiding this comment.
I think we usually put deprecated parameters at the end
thomasjpfan
left a comment
There was a problem hiding this comment.
Minor nits otherwise lgtm
| class_of_interest=None, | ||
| multiclass_colors=None, | ||
| target_colors=None, | ||
| multiclass_colors="deprecated", # TODO(1.12): remove |
| .. versionadded:: 1.10 | ||
| `multiclass_colors` was renamed to `target_colors` | ||
|
|
||
| multiclass_colors : str or list of matplotlib colors, default=None |
| response, | ||
| multiclass_colors=None, | ||
| target_colors=None, | ||
| multiclass_colors="deprecated", # TODO(1.12): remove |
|
Thank you for the feedback @lucyleeow and @thomasjpfan! |
|
Thank you! |
…isionBoundaryDisplay` (scikit-learn#34092)
Reference Issues/PRs
Towards #33115 (pre-requisite for Point 4: unify binary and multiclass color-handling)
What does this implement/fix? Explain your changes.
Renames the parameter
multiclass_colorsaslabel_colorstarget_colorsand the attributemulticlass_colors_aslabel_colors_target_colors_, respectively.This is done so that in a next step, binary problems can also use this parameter/attribute for plotting decision boundaries (which will in turn remove the current inconsistencies when zooming in on the plot, making it binary internally when only two classes are visible, see #33211).
I also adapted all examples accordingly.
AI usage disclosure
I used AI assistance for:
Any other comments?
I went withlabel_colors(suggested by @lucyleeow here), but now I'm not sure if something more generic likeplot_colorswould actually be better given that we also support regression. WDYT?Taking up the suggestion from this comment below, I went with
target_colorsnow.(The branch was named for the next step, but then I realised that it probably makes sense to first do this deprecation in a separate PR.)