Skip to content

[MRG] ENH Quantile bin support for calibration_curve - #13087

Merged
qinhanmin2014 merged 11 commits into
scikit-learn:masterfrom
srcole:master
Feb 8, 2019
Merged

qinhanmin2014 merged 11 commits into
scikit-learn:masterfrom
srcole:master

Conversation

@srcole

@srcole srcole commented Feb 4, 2019 •

Copy link
Copy Markdown
Contributor

Fixes #13086

As discussed in issue #13086, I’ve added support for the bins in calibration_curve to be set by equally separated quantiles of the data.

To do this, I added a new kwarg, quantile_split which is False by default, but adds the functionality when it is set to True.

I added a simple test for the functionality within tests.test_calibration.test_calibration_curve that mimics the tests for the basic functionality.

Any suggestions for changes? Should we add a more illustrative example to the examples pages?

@srcole

srcole commented Feb 4, 2019

Copy link
Copy Markdown
Contributor Author

I'm a little confused why Travis says AttributeError: module 'numpy' has no attribute 'quantile' since np.quantile is a function. Maybe the function np.quantile is too new? Looks like it was merged in April 2018.

@srcole srcole changed the title Quantile bin support for calibration_curve [WIP] Quantile bin support for calibration_curve Feb 4, 2019
@jnothman

jnothman commented Feb 4, 2019 via email

Copy link
Copy Markdown
Member

@jnothman

jnothman commented Feb 4, 2019 via email

Copy link
Copy Markdown
Member

@srcole

srcole commented Feb 4, 2019

Copy link
Copy Markdown
Contributor Author

Good suggestions. Any other comments?

I'm wondering:

  1. I'm raising a ValueError if an input other than 'quantile' or 'uniform' is entered into 'strategy'. Does this / the text seem ok?
  2. Are the tests sufficient?
  3. Are examples needed elsewhere in the documentation?

@jnothman jnothman 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.

Otherwise I think this looks good

Comment thread sklearn/calibration.py

strategy : {'uniform', 'quantile'}, (default='uniform')
Strategy used to define the widths of the bins.
uniform

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.

put a blank line before this for correct rendering in HTML

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

You're saying a blank line between the lines starting with "strategy" and the line with "uniform"?

Comment thread sklearn/calibration.py Resolved
Comment thread sklearn/calibration.py Resolved
Comment thread sklearn/tests/test_calibration.py Resolved
Comment thread sklearn/tests/test_calibration.py Resolved
Comment thread sklearn/tests/test_calibration.py Resolved

@jnothman jnothman 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.

Please rename the PR from WIP to MRG

Comment thread sklearn/tests/test_calibration.py Resolved
@srcole srcole changed the title [WIP] Quantile bin support for calibration_curve [MRG] Quantile bin support for calibration_curve Feb 5, 2019
@srcole

srcole commented Feb 5, 2019

Copy link
Copy Markdown
Contributor Author

cool. anything else I can do?

@jnothman jnothman 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.

Please wait for another review. It can be slow.

Please add an entry to the change log at doc/whats_new/v0.21.rst. Like the other entries there, please reference this pull request with :issue: and credit yourself (and other contributors if applicable) with :user:

@jnothman jnothman changed the title [MRG] Quantile bin support for calibration_curve [MRG] ENH Quantile bin support for calibration_curve Feb 5, 2019
@srcole

srcole commented Feb 5, 2019

Copy link
Copy Markdown
Contributor Author

Added the entry to whats_new.
Thanks for all your help through the issue and PR!

@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 @srcole

@qinhanmin2014
qinhanmin2014 merged commit af74b8d into scikit-learn:master Feb 8, 2019
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
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
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.

3 participants