Skip to content
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

ENH Emphasize discussion on multi-class classification in tree notebook #730

Merged
merged 17 commits into from
Oct 23, 2023

Conversation

ArturoAmorQ
Copy link
Collaborator

This PR reworks the general wording to avoid redundant text and prefer verbs in present mode.
It also adds a plot of predict_proba per class, as inspired by the Plot classification probability example

Copy link
Collaborator

@ogrisel ogrisel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I pushed some commits to adjust the colormaps to:

  • avoid using a binary Red Blue colormap for multiclass decision boundary,
  • use a continuous viridis for the predict_proba plots because 0.5 is not meaningful any more in a one vs rest setting.

Below are some more suggestions, but beyond this, LGTM.

python_scripts/trees_sol_01.py Show resolved Hide resolved
python_scripts/trees_sol_01.py Outdated Show resolved Hide resolved
python_scripts/trees_classification.py Outdated Show resolved Hide resolved
python_scripts/trees_classification.py Outdated Show resolved Hide resolved
python_scripts/trees_classification.py Outdated Show resolved Hide resolved
python_scripts/trees_classification.py Outdated Show resolved Hide resolved
Comment on lines 138 to 141
# For example, in the plot below, the first plot on the left shows in red the
# certainty on classifying a data point as belonging to the "Adelie" class. In
# the same plot, the blue color represents the certainty of **not** belonging to
# the "Adelie" class. The same logic applies to the other plots in the figure.
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ogrisel does this paragraph make sense to you when using a diverging colormap?
Or can you please elaborate on how the 0.5 probability cannot be interpreted under this one-vs-rest logic?

Copy link
Collaborator

@ogrisel ogrisel Oct 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed this paragraph needs to be updated with the new colors (e.g. bright yellow vs dark purple). What I mean is that the chance level for a one vs rest binary classification problem that comes from a multi-class classification problem is almost never at 0.5. So using a colormap with a neutral white at 0.5 might give a false impression.

When we do one-vs-rest, we do not threshold the value of predict_proba at 0.5 to get the hard class predictions but instead concatenate of the 3 one-vs-rest predict_proba vectors into a 2D array and take the argmax across the classes dimension.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it make sense to keep the colorbar at the bottom of the plot in this case?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe so.

Copy link
Collaborator

@ogrisel ogrisel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A final batch of feedback. Otherwise LGTM. The rendering looks good.

python_scripts/trees_classification.py Outdated Show resolved Hide resolved
python_scripts/trees_classification.py Outdated Show resolved Hide resolved
python_scripts/trees_classification.py Outdated Show resolved Hide resolved
python_scripts/trees_classification.py Outdated Show resolved Hide resolved
python_scripts/trees_sol_01.py Outdated Show resolved Hide resolved
@ogrisel ogrisel merged commit c9a7ad4 into INRIA:main Oct 23, 2023
2 checks passed
github-actions bot pushed a commit that referenced this pull request Oct 23, 2023
…ree notebook (#730)

Co-authored-by: ArturoAmorQ <[email protected]>
Co-authored-by: Olivier Grisel <[email protected]> c9a7ad4
@ArturoAmorQ ArturoAmorQ deleted the rework_trees branch October 23, 2023 10:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants