Skip to content

Commit

Permalink
Merge pull request #695 from Epistimio/release-v0.2.0rc1
Browse files Browse the repository at this point in the history
Release v0.2.0rc1
  • Loading branch information
bouthilx authored Nov 24, 2021
2 parents 0ef3eea + 93e49b5 commit 6ee3d63
Show file tree
Hide file tree
Showing 110 changed files with 2,957 additions and 2,304 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Software License Agreement (BSD License)

Copyright (c) 2017-2020, Epistímio.
Copyright (c) 2017-2021, Epistímio.
All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand Down
6 changes: 3 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ If you use Oríon for published work, please cite our work using the following b

.. code-block:: bibtex
@software{xavier_bouthillier_2021_0_1_15,
@software{xavier_bouthillier_2021_0_2_0,
author = {Xavier Bouthillier and
Christos Tsirigotis and
François Corneau-Tremblay and
Expand All @@ -142,10 +142,10 @@ If you use Oríon for published work, please cite our work using the following b
Pascal Lamblin and
Christopher Beckham},
title = {{Epistimio/orion: Asynchronous Distributed Hyperparameter Optimization}},
month = may,
month = nov,
year = 2021,
publisher = {Zenodo},
version = {v0.1.17},
version = {v0.2.0},
doi = {10.5281/zenodo.3478592},
url = {https://doi.org/10.5281/zenodo.3478592}
}
Expand Down
24 changes: 17 additions & 7 deletions ROADMAP.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,35 @@
# Roadmap
Last update Sep 14th, 2021
Last update Nov 23rd, 2021

## Next releases - Short-Term

### v0.2
### v0.2.1

#### Generic `Optimizer` interface supporting various types of algorithms
- New master process to enhance parallelisation efficiency.
- [PBT](https://arxiv.org/abs/1711.09846)

Change interface to support trial object instead of curated lists. This is necessary to support algorithms such as PBT.
### v0.2.2

- Use shared algo serialization instead of replications to enhance parallelisation efficiency.
- [DEBH](https://arxiv.org/abs/2105.09821)

### v0.2.3

- [HEBO](https://github.com/huawei-noah/HEBO/tree/master/HEBO/archived_submissions/hebo)

### v0.2.4

#### More Optimizers
- [PBT](https://arxiv.org/abs/1711.09846)
- [BOHB](https://ml.informatik.uni-freiburg.de/papers/18-ICML-BOHB.pdf)

## Next releases - Mid-Term

#### Simple dashboard specific to monitoring and benchmarking of Black-Box optimization
- Specific to hyper parameter optimizations
- Provide status of experiments

#### Leveraging previous experiences
Leveraging the knowledge base contained in the EVC of previous trials to optimize and drive new
trials.
trials.

## Next releases - Long-Term

Expand Down
2 changes: 1 addition & 1 deletion docs/src/code/algo/asha.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ Asynchronous Successive Halving Algorithm

Can't build documentation because of import order.
Sphinx is loading ``orion.algo.asha`` before ``orion.algo`` and therefore
there is a cycle between the definition of ``OptimizationAlgorithm`` and
there is a cycle between the definition of ``BaseAlgorithm`` and
``ASHA`` as the meta-class ``Factory`` is trying to import ``ASHA``.
`PR #135 <https://github.com/Epistimio/orion/pull/135/files>`_ should get rid of this problem.
2 changes: 0 additions & 2 deletions docs/src/code/core/io/database.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,3 @@ Databases
.. automodule:: orion.core.io.database
:members:
:show-inheritance:


1 change: 0 additions & 1 deletion docs/src/code/core/utils.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ Utilities
utils/format_trials
utils/format_terminal
utils/singleton
utils/points

.. automodule:: orion.core.utils
:members:
5 changes: 0 additions & 5 deletions docs/src/code/core/utils/points.rst

This file was deleted.

2 changes: 1 addition & 1 deletion docs/src/install/gettingstarted.rst
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ For the previous example, we would run

.. code-block:: console
$ orion hunt -n <experiment name> script.py --lr~'loguniform(1e-5, 1.0)'
$ orion hunt -n <experiment name> --max-trials 10 python script.py --lr~'loguniform(1e-5, 1.0)'
This is going to start the optimization process using the default optimization algorithm and sample
the values for the ``lr`` hyper-parameter in a log uniform distribution between 0.00001 et 1.0. Each
Expand Down
30 changes: 23 additions & 7 deletions docs/src/user/config.rst
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ Full Example of Global Configuration
heartbeat: 120
interrupt_signal_code: 130
max_broken: 10
max_idle_time: 60
reservation_timeout: 60
max_trials: 1000000000
user_script_config: config
Expand Down Expand Up @@ -365,7 +365,7 @@ Worker
heartbeat: 120
interrupt_signal_code: 130
max_broken: 10
max_idle_time: 60
reservation_timeout: 60
max_trials: 1000000000
user_script_config: config
Expand Down Expand Up @@ -464,21 +464,37 @@ max_broken
Maximum number of broken trials before worker stops.


.. _config_worker_reservation_timeout:

reservation_timeout
~~~~~~~~~~~~~~~~~~~

:Type: int
:Default: 60
:Env var: ORION_RESERVATION_TIMEOUT
:Description:
Maximum time the experiment can spend trying to reserve a new suggestion. Such timeout are
generally caused by slow database, large number of concurrent workers leading to many race
conditions or small search spaces with integer/categorical dimensions that may be fully
explored.


.. _config_worker_max_idle_time:

max_idle_time
~~~~~~~~~~~~~

.. warning::

**DEPRECATED.** This argument will be removed in v0.3.
Use :ref:`config_worker_reservation_timeout` instead.

:Type: int
:Default: 60
:Env var: ORION_MAX_IDLE_TIME
:Description:
Maximum time the producer can spend trying to generate a new suggestion.Such timeout are
generally caused by slow database, large number of concurrent workers leading to many race
conditions or small search spaces with integer/categorical dimensions that may be fully
explored.

(DEPRECATED) This argument will be removed in v0.3. Use :ref:`config_worker_reservation_timeout`
instead.


.. _config_worker_interrupt_signal_code:
Expand Down
2 changes: 1 addition & 1 deletion docs/src/user/parallel.rst
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Executor backends
It is also possible to execute multiple workers using the argument ``--n-workers`` in commandline
or ``experiment.workon(n_workers)`` using the python API. The workers will work together
using the same mechanisms explained above, but an
:class:`orion.executor.base.Executor` backend will be used in addition
:class:`orion.executor.base.BaseExecutor` backend will be used in addition
to spawn the workers and maintain them alive. The default backend is :ref:`executor-joblib`.

You can configure it
Expand Down
4 changes: 4 additions & 0 deletions docs/src/user/storage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -477,18 +477,22 @@ Here's an example on how you could remove an experiment
--------------

.. automethod:: orion.core.io.database.Database.read
:noindex:

:hidden:`write`
---------------

.. automethod:: orion.core.io.database.Database.write
:noindex:

:hidden:`remove`
----------------

.. automethod:: orion.core.io.database.Database.remove
:noindex:

:hidden:`read_and_write`
------------------------

.. automethod:: orion.core.io.database.Database.read_and_write
:noindex:
11 changes: 8 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,19 +46,24 @@
"console_scripts": [
"orion = orion.core.cli:main",
],
"OptimizationAlgorithm": [
"BaseAlgorithm": [
"random = orion.algo.random:Random",
"gridsearch = orion.algo.gridsearch:GridSearch",
"asha = orion.algo.asha:ASHA",
"hyperband = orion.algo.hyperband:Hyperband",
"tpe = orion.algo.tpe:TPE",
"EvolutionES = orion.algo.evolution_es:EvolutionES",
],
"Storage": [
"Database": [
"ephemeraldb = orion.core.io.database.ephemeraldb:EphemeralDB",
"pickleddb = orion.core.io.database.pickleddb:PickledDB",
"mongodb = orion.core.io.database.mongodb:MongoDB",
],
"BaseStorageProtocol": [
"track = orion.storage.track:Track",
"legacy = orion.storage.legacy:Legacy",
],
"Executor": [
"BaseExecutor": [
"singleexecutor = orion.executor.single_backend:SingleExecutor",
"joblib = orion.executor.joblib_backend:Joblib",
"dask = orion.executor.dask_backend:Dask",
Expand Down
62 changes: 39 additions & 23 deletions src/orion/algo/asha.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,8 @@ def __init__(

self.brackets = self.create_brackets()

self.seed_rng(seed)

def compute_bracket_idx(self, num):
def assign_resources(n, remainings, totals):
if n == 0 or remainings.sum() == 0:
Expand Down Expand Up @@ -192,7 +194,7 @@ def sample(self, num):
return samples

def suggest(self, num):
return super(ASHA, self).suggest(1)
return super(ASHA, self).suggest(num)

def create_bracket(self, i, budgets, iteration):
return ASHABracket(self, budgets, iteration)
Expand All @@ -217,32 +219,39 @@ def sample(self, num):
should_have_n_trials = self.rungs[0]["n_trials"]
return self.hyperband.sample_for_bracket(num, self)

def get_candidate(self, rung_id):
"""Get a candidate for promotion"""
def get_candidates(self, rung_id):
"""Get a candidate for promotion
Raises
------
TypeError
If get_candidates is called before the entire rung is completed.
"""
rung = self.rungs[rung_id]["results"]
next_rung = self.rungs[rung_id + 1]["results"]

rung = list(
sorted(
(objective, point)
for objective, point in rung.values()
(objective, trial)
for objective, trial in rung.values()
if objective is not None
)
)
k = len(rung) // self.hyperband.reduction_factor
k = min(k, len(rung))

candidates = []
for i in range(k):
point = rung[i][1]
_id = self.hyperband.get_id(point, ignore_fidelity=True)
trial = rung[i][1]
_id = self.hyperband.get_id(trial, ignore_fidelity=True)
if _id not in next_rung:
return point
candidates.append(trial)

return None
return candidates

@property
def is_filled(self):
"""ASHA's first rung can always sample new points"""
"""ASHA's first rung can always sample new trials"""
return False

def is_ready(self, rung_id=None):
Expand All @@ -254,7 +263,7 @@ def promote(self, num):
The rungs are iterated over in reversed order, so that high rungs
are prioritised for promotions. When a candidate is promoted, the loop is broken and
the method returns the promoted point.
the method returns the promoted trial.
.. note ::
Expand All @@ -266,27 +275,34 @@ def promote(self, num):
if num < 1 or self.is_done:
return []

candidates = []
for rung_id in range(len(self.rungs) - 2, -1, -1):
candidate = self.get_candidate(rung_id)
if candidate:

for candidate in self.get_candidates(rung_id):
# pylint: disable=logging-format-interpolation
logger.debug(
"Promoting {point} from rung {past_rung} with fidelity {past_fidelity} to "
"Promoting {trial} from rung {past_rung} with fidelity {past_fidelity} to "
"rung {new_rung} with fidelity {new_fidelity}".format(
point=candidate,
trial=candidate,
past_rung=rung_id,
past_fidelity=candidate[self.hyperband.fidelity_index],
past_fidelity=candidate.params[self.hyperband.fidelity_index],
new_rung=rung_id + 1,
new_fidelity=self.rungs[rung_id + 1]["resources"],
)
)

candidate = list(copy.deepcopy(candidate))
candidate[self.hyperband.fidelity_index] = self.rungs[rung_id + 1][
"resources"
]
candidate = candidate.branch(
status="new",
params={
self.hyperband.fidelity_index: self.rungs[rung_id + 1][
"resources"
]
},
)

if not self.hyperband.has_suggested(candidate):
candidates.append(candidate)

return [tuple(candidate)]
if len(candidates) >= num:
return candidates

return []
return candidates
Loading

0 comments on commit 6ee3d63

Please sign in to comment.