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

[tune] add more stoppers and stopper documentation #12750

Merged
merged 8 commits into from
Dec 12, 2020

Conversation

krfricke
Copy link
Contributor

Why are these changes needed?

Stoppers are currently not documented. This PR adds stoppers to the documentation.

Also, we introduce two new stoppers, the maximum iteration stopper and the trial plateau stopper. The former is important for use in conjunction e.g. with the combined stopper. The latter is a utility used in tune-sklearn and might be of interest for other users.

Tests were added as well.

Related issue number

Checks

  • I've run scripts/format.sh to lint the changes in this PR.
  • I've included any doc changes needed for https://docs.ray.io/en/master/.
  • I've made sure the tests are passing. Note that there might be a few flaky tests, see the recent failures at https://flakey-tests.ray.io/
  • Testing Strategy
    • Unit tests
    • Release tests
    • This PR is not tested :(

Copy link
Contributor

@richardliaw richardliaw left a comment

Choose a reason for hiding this comment

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

nice! thanks a bunch for doing this. Left a couple docs comments.

python/ray/tune/stopper.py Outdated Show resolved Hide resolved
Comment on lines +147 to +148
std (float): The minimal standard deviation after which
the tuning process has to stop.
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead, we should have something like an absolute threshold instead of std; std can have instabilities at small values anyways.

Copy link
Contributor

Choose a reason for hiding this comment

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

But maybe it is out of scope :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I kept std as it was used in the ExperimentPlateauStopper. If we change this we should change this for both. Let's chat about this really quick offline later.

doc/source/tune/api_docs/stoppers.rst Outdated Show resolved Hide resolved
doc/source/tune/api_docs/stoppers.rst Outdated Show resolved Hide resolved
doc/source/tune/api_docs/stoppers.rst Outdated Show resolved Hide resolved
doc/source/tune/api_docs/stoppers.rst Show resolved Hide resolved
python/ray/tune/stopper.py Outdated Show resolved Hide resolved

Args:
metric (str): Metric to check for convergence.
std (float): Maximum metric standard deviation to decide if a
Copy link
Contributor

Choose a reason for hiding this comment

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

also similar comment here about std vs threshold

python/ray/tune/stopper.py Show resolved Hide resolved
krfricke and others added 5 commits December 11, 2020 12:20
Co-authored-by: Richard Liaw <rliaw@berkeley.edu>
Co-authored-by: Richard Liaw <rliaw@berkeley.edu>
Co-authored-by: Richard Liaw <rliaw@berkeley.edu>
Copy link
Contributor

@amogkam amogkam left a comment

Choose a reason for hiding this comment

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

LGTM! Just left one small comment

@@ -43,6 +46,27 @@ def stop_all(self):


class CombinedStopper(Stopper):
"""Combine several stoppers.
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it worth mentioning that this combines Stoppers via OR and not AND, i.e stopping conditions are determined based on if any of the stopping conditions are met rather than all?

Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm, this is internal API now (not publicly listed on the documentation), so I'm guessing users will need to read source code anyways to read this. I'll add a small note though.

Comment on lines +170 to +171
elif isinstance(stop, list):
if any(not isinstance(s, Stopper) for s in stop):
Copy link
Contributor

Choose a reason for hiding this comment

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

be sure to document this later, and also note list as a possible return-type in the error message at end of the switch-case block.

@richardliaw richardliaw merged commit 5f04ade into ray-project:master Dec 12, 2020
@krfricke krfricke deleted the tune-stoppers branch December 12, 2020 09:47
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.

None yet

3 participants