Last active
September 6, 2020 18:10
-
-
Save himanshurawlani/acb3a2e44b88b284fef504a45b238393 to your computer and use it in GitHub Desktop.
An example for creating trial scheduler and search algorithm using Ray Tune
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
logger.info("Initializing ray") | |
ray.init(configure_logging=False) | |
logger.info("Initializing ray search space") | |
search_space, intial_best_config = create_search_space() | |
logger.info("Initializing scheduler and search algorithms") | |
# Use HyperBand scheduler to earlystop unpromising runs | |
scheduler = AsyncHyperBandScheduler(time_attr='training_iteration', | |
metric="val_loss", | |
mode="min", | |
grace_period=10) | |
# Use bayesian optimisation with TPE implemented by hyperopt | |
search_alg = HyperOptSearch(search_space, | |
metric="val_loss", | |
mode="min", | |
points_to_evaluate=intial_best_config) | |
# We limit concurrent trials to 2 since bayesian optimisation doesn't parallelize very well | |
search_alg = ConcurrencyLimiter(search_alg, max_concurrent=2) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment