Skip to content

Add HyperbandPruner#809

Merged
sile merged 25 commits intooptuna:masterfrom
crcrpar:naive-hyperband
Jan 15, 2020
Merged

Add HyperbandPruner#809
sile merged 25 commits intooptuna:masterfrom
crcrpar:naive-hyperband

Conversation

@crcrpar
Copy link
Copy Markdown
Contributor

@crcrpar crcrpar commented Dec 18, 2019

This depends on #808
The algorithm would behave differently from the paper if the sampler is TPESampler because there is no way to filter out the trials of brackets other than that of the running trial.


Although #785 and #805 are for Hyperband, this PR follows another design policy.
The core design of #785 is to realize filtering by adding an attribute that represents pruner to Trial.
It will make Study more complex while it can keep the current loosely connected relationship between Sampler and Pruner.

On the other hand, the policy of this PR does not implement any filtering of trials.
This means that we will need to add some interaction between HyperbandPruner and Sampler, especially TPESampler.

EDIT:
In this implementation, trials are filtered by bracket_id that is computed by HyperbandPruner._get_bracket_id and this filtering is enabled by implementing _BracketStudy which just wraps Study for the HyperbandPruner use only. The idea is suggested in #809 (comment).

@codecov-io
Copy link
Copy Markdown

codecov-io commented Dec 18, 2019

Codecov Report

❗ No coverage uploaded for pull request base (master@2ebb157). Click here to learn what that means.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master     #809   +/-   ##
=========================================
  Coverage          ?   90.13%           
=========================================
  Files             ?      108           
  Lines             ?     8914           
  Branches          ?        0           
=========================================
  Hits              ?     8035           
  Misses            ?      879           
  Partials          ?        0
Impacted Files Coverage Δ
optuna/pruners/base.py 62.5% <ø> (ø)
setup.py 0% <ø> (ø)
optuna/study.py 93.62% <100%> (ø)
optuna/pruners/hyperband.py 78.57% <100%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2ebb157...7bc4874. Read the comment docs.

@crcrpar crcrpar force-pushed the naive-hyperband branch 3 times, most recently from 0921c30 to 584286b Compare December 19, 2019 08:44
Copy link
Copy Markdown
Member

@sile sile left a comment

Choose a reason for hiding this comment

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

Thank you for the swift update. The current design looks good for me.
By the way, I left some minor comments about the code detail.

return self._n_pruners


class _BracketStudy(Study):
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.

Other methods besides get_trials might behaive unexpectedly as they are not filtered. I believe we can either override and raise, or avoid inheriting from Study.

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.

I tried to disable other methods of Study in a naive way. PTAL.

@crcrpar crcrpar requested a review from hvy December 25, 2019 09:45
crcrpar added a commit to crcrpar/optuna that referenced this pull request Dec 26, 2019
@crcrpar
Copy link
Copy Markdown
Contributor Author

crcrpar commented Dec 26, 2019

As to n_brackets, following #809 (comment) and #809 (comment), I'd like to make it defaults to 4.

(This is the clarification as the discussion is getting long and not accessible.)

Copy link
Copy Markdown
Member

@c-bata c-bata left a comment

Choose a reason for hiding this comment

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

LGTM with nits!! I think current implementation is reasonable for now 👍 Good job @crcrpar.

@crcrpar
Copy link
Copy Markdown
Contributor Author

crcrpar commented Dec 26, 2019

Discussed how to compute budgets and allocate trials to brackets with @sile, and one way is to merge this without any modification because

  • currently, there doesn't seem to be any colossal problem like poor performance
  • it might take a long time to design a reasonable algorithm and the PR for it might be not tiny

I don't mean we should stop here, merge first without further improvement. From the perspective of the granularity and duration of the PR, merging is one option.

@sile sile mentioned this pull request Dec 27, 2019
@sile sile removed this from the v1.0.0 milestone Jan 9, 2020
@hvy hvy added this to the v1.1.0 milestone Jan 9, 2020
@crcrpar crcrpar requested a review from hvy January 9, 2020 06:03
Copy link
Copy Markdown
Member

@hvy hvy left a comment

Choose a reason for hiding this comment

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

LGTM!

@crcrpar
Copy link
Copy Markdown
Contributor Author

crcrpar commented Jan 14, 2020 via email

crcrpar added a commit to crcrpar/optuna that referenced this pull request Jan 15, 2020
@crcrpar
Copy link
Copy Markdown
Contributor Author

crcrpar commented Jan 15, 2020

Added the TODO.

@sile
Copy link
Copy Markdown
Member

sile commented Jan 15, 2020

Added the TODO.

Thanks!
I'll merge this PR.

@sile sile merged commit 0db5508 into optuna:master Jan 15, 2020
@crcrpar crcrpar deleted the naive-hyperband branch January 21, 2020 05:50
@hvy hvy mentioned this pull request Feb 5, 2020
@PhilipMay
Copy link
Copy Markdown
Contributor

Thanks for this implementation! It's awsome! :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature Change that does not break compatibility, but affects the public interfaces.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants