Skip to content

EXA plot_confusion_matrix example breaks down if not all classes present - #13126

Merged
adrinjalali merged 3 commits into
scikit-learn:masterfrom
MLopez-Ibanez:master
Feb 10, 2019
Merged

adrinjalali merged 3 commits into
scikit-learn:masterfrom
MLopez-Ibanez:master

Conversation

@MLopez-Ibanez

Copy link
Copy Markdown
Contributor

…es are present in the test data

Reference Issues/PRs

Fixes #12700

What does this implement/fix? Explain your changes.

  • Make sure we don't use class labels that do not appear in the data using unique_labels (same thing that confusion_matrix does)

  • The default title says whether the matrix uses normalization or not.

  • Use explicit fig, ax instead of default figure and axes, and return axas recommended by Matplotlib.

  • Avoid itertools, it doesn't make the code simpler and this is not code that needs to be optimized.

@qinhanmin2014 qinhanmin2014 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, thanks @MLopez-Ibanez

@qinhanmin2014 qinhanmin2014 changed the title fix #12700 plot_confusion_matrix example breaks down if not all class… EXA plot_confusion_matrix example breaks down if not all classes present Feb 10, 2019
@adrinjalali

Copy link
Copy Markdown
Member

thanks @MLopez-Ibanez !

@adrinjalali
adrinjalali merged commit 0a1ee74 into scikit-learn:master Feb 10, 2019
jnothman pushed a commit to jnothman/scikit-learn that referenced this pull request Feb 19, 2019
…ent (scikit-learn#13126)

* fix scikit-learn#12700 plot_confusion_matrix example breaks down if not all classes are present in the test data

* plot_confusion_matrix: update function call, fix style issues

* remove redundant confusion_matrix call
xhluca pushed a commit to xhluca/scikit-learn that referenced this pull request Apr 28, 2019
…ent (scikit-learn#13126)

* fix scikit-learn#12700 plot_confusion_matrix example breaks down if not all classes are present in the test data

* plot_confusion_matrix: update function call, fix style issues

* remove redundant confusion_matrix call
xhluca pushed a commit to xhluca/scikit-learn that referenced this pull request Apr 28, 2019
xhluca pushed a commit to xhluca/scikit-learn that referenced this pull request Apr 28, 2019
koenvandevelde pushed a commit to koenvandevelde/scikit-learn that referenced this pull request Jul 12, 2019
…ent (scikit-learn#13126)

* fix scikit-learn#12700 plot_confusion_matrix example breaks down if not all classes are present in the test data

* plot_confusion_matrix: update function call, fix style issues

* remove redundant confusion_matrix call
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.

plot_confusion_matrix example breaks down if not all classes are present in the test data

3 participants