Skip to content

[MRG] implements log-uniform random variable - #11232

Merged
glemaitre merged 42 commits into
scikit-learn:masterfrom
stsievert:lograndom
Oct 2, 2019
Merged

glemaitre merged 42 commits into
scikit-learn:masterfrom
stsievert:lograndom

Conversation

@stsievert

Copy link
Copy Markdown
Contributor

Reference Issues/PRs

Fixes #9919, "implement/benchmark loguniform random variable for randomized search"

What does this implement/fix? Explain your changes.

This PR

  • implements a log-uniform random variable
  • provides tests
  • implements an example
  • is meant to be used with ParameterSampler, and implements a test accordingly

Any other comments?

This PR will be useful for dask/dask-searchcv#72

I believe I've followed everything in the contributor guidelines.

cc @sauln

@stsievert stsievert changed the title Lograndom [MRG] implements log-uniform random variable Jun 11, 2018

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

Thanks for the PR. Tests are failing.

Comment thread sklearn/utils/random.py Resolved
@stsievert

Copy link
Copy Markdown
Contributor Author

Thanks for the review @jnothman. I've updated to address both comments. I return a scalar and have updated the example to use SGDClassifier instead of RandomForestClassifier.

Comment thread sklearn/utils/random.py Resolved
Comment thread sklearn/utils/random.py Resolved
Comment thread sklearn/utils/random.py Resolved
Comment thread sklearn/utils/tests/test_random.py Resolved
Comment thread sklearn/utils/tests/test_random.py Resolved
Comment thread sklearn/utils/random.py Resolved
Comment thread sklearn/utils/tests/test_random.py Resolved
@stsievert

Copy link
Copy Markdown
Contributor Author

Updated. Thanks for the review.

Comment thread sklearn/utils/tests/test_random.py Resolved
Comment thread sklearn/utils/tests/test_random.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.

Otherwise LGTM

Comment thread sklearn/utils/tests/test_random.py Resolved
Comment thread sklearn/utils/random.py Resolved
Comment thread sklearn/utils/tests/test_random.py Resolved
@jnothman

Copy link
Copy Markdown
Member

Please also list this in doc/modules/classes.rst. It's also worth mentioning in doc/modules/grid_search.rst

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

@stsievert
stsievert force-pushed the lograndom branch 2 times, most recently from 0a9fb8e to 91d43d7 Compare June 13, 2018 17:06

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

Nice work

Comment thread doc/whats_new/v0.20.rst Resolved
Comment thread sklearn/utils/random.py Resolved
Comment thread sklearn/utils/random.py Resolved
Comment thread sklearn/utils/random.py Resolved
@stsievert

Copy link
Copy Markdown
Contributor Author

I've addressed the review, resolved merge conflicts by rebasing, and have tested locally on my machine with flake8.

Comment thread doc/modules/grid_search.rst Resolved
Comment thread sklearn/utils/tests/test_random.py Resolved
Comment thread sklearn/utils/tests/test_random.py Resolved
@stsievert

Copy link
Copy Markdown
Contributor Author

Updated.

As implemented, this API uses low, high arguments, which is the same as np.random.uniform. scipy.stats uses low, width arguments. I think we should mirror the API np.random.uniform uses because the names are so similar (loguniform vs uniform).

@jnothman

jnothman commented Feb 5, 2019

Copy link
Copy Markdown
Member

Please resolve conflicts with master, and maybe we can find a way towards review and merge.

MAINT: get loguniform working. proper API and example

TST: proper assertions on types

MAINT: do not silence warnings in example

MAINT: update for review

MAINT: add more review
MAINT: address review

MAINT: make edits

MAINT: circleci
@rth rth removed the Needs work label Sep 23, 2019

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

A few more comments, otherwise looks good to me.

Comment thread doc/whats_new/v0.22.rst Resolved
Comment thread doc/modules/classes.rst Resolved
Comment thread doc/modules/grid_search.rst Resolved
Comment thread doc/modules/grid_search.rst Resolved
Comment thread doc/modules/grid_search.rst Resolved
Comment thread sklearn/utils/fixes.py Resolved
Comment thread sklearn/utils/fixes.py Resolved
@glemaitre
glemaitre self-requested a review September 24, 2019 14:15
@glemaitre

Copy link
Copy Markdown
Member

Be aware that I made a push to trigger the build of the documentation.

@thomasjpfan

Copy link
Copy Markdown
Member

Are we okay with supporting an alias?

@glemaitre

Copy link
Copy Markdown
Member

I am fine with the atlas and once scipy/scipy#10815 is merged, we can import from scipy when available and later on deprecate it.

@rth

rth commented Sep 24, 2019

Copy link
Copy Markdown
Member

Are we okay with supporting an alias?

Once scipy/scipy#10815 is merged, it will be simply be a backport. However we can't backport code from that PR as that uses the private aliasing mechanism from scipy 1.3 as far as I understand. So this PR is still needed.

@glemaitre glemaitre 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. I just fix something is in the doc and I will check the artefacts before to merge.

@glemaitre
glemaitre merged commit 7cb5daf into scikit-learn:master Oct 2, 2019
@stsievert
stsievert deleted the lograndom branch October 2, 2019 14:22
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.

implement / benchmark loguniform distribution for randomized search

7 participants