Skip to content

Commit 0ef3eea

Browse files
authored
Merge pull request #663 from Epistimio/release-v0.1.17rc1
Release candidate v0.1.17rc1
2 parents 6bc3b79 + bd33c32 commit 0ef3eea

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+900
-415
lines changed

README.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ If you use Oríon for published work, please cite our work using the following b
129129
Dendi Suhubdy and
130130
Reyhane Askari and
131131
Michael Noukhovitch and
132-
Chao Xua and
132+
Chao Xue and
133133
Satya Ortiz-Gagné and
134134
Olivier Breuleux and
135135
Arnaud Bergeron and
@@ -145,7 +145,7 @@ If you use Oríon for published work, please cite our work using the following b
145145
month = may,
146146
year = 2021,
147147
publisher = {Zenodo},
148-
version = {v0.1.15},
148+
version = {v0.1.17},
149149
doi = {10.5281/zenodo.3478592},
150150
url = {https://doi.org/10.5281/zenodo.3478592}
151151
}

ROADMAP.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
11
# Roadmap
2-
Last update May 19th, 2021
2+
Last update Sep 14th, 2021
33

44
## Next releases - Short-Term
55

6-
### v0.1.16
7-
8-
#### Quick release for bug fixes
9-
106
### v0.2
117

128
#### Generic `Optimizer` interface supporting various types of algorithms

docs/src/install/gettingstarted.rst

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,10 @@ the values for the ``lr`` hyper-parameter in a log uniform distribution between
6262
trial will be stored in the database that you configured during the installation process (which can
6363
be in-memory, a file, or a local or remote MongoDB instance).
6464

65-
Additionally, the experiments are versioned -- think of it as a git for scientific experimentation
66-
-- enabling you to keep track of all your trials with their parameters. This guarantees that you can
67-
reproduce or trace back the steps in your work for free.
65+
Additionally, the experiments can be versioned -- think of it as a git for scientific
66+
experimentation -- enabling you to keep track of all your trials with their parameters. This
67+
guarantees that you can reproduce or trace back the steps in your work for free. See configuration
68+
options for the :ref:`config_evc` to enable the versionning of the experiments.
6869

6970
You can fine-tune the distribution and algorithm with many options either with more arguments or by
7071
using a configuration file. Learn more at :doc:`/user/api`.

docs/src/tutorials/pytorch-mnist.rst

Lines changed: 0 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -162,76 +162,3 @@ don't use ``--debug`` you will likely quickly fill your database with broken exp
162162
.. code-block:: bash
163163
164164
$ orion --debug hunt -n orion-tutorial python main.py --lr~'loguniform(1e-5, 1.0)'
165-
166-
Hunting Options
167-
---------------
168-
169-
.. code-block:: console
170-
171-
$ orion hunt --help
172-
173-
Oríon arguments (optional):
174-
These arguments determine orion's behaviour
175-
176-
-n stringID, --name stringID
177-
experiment's unique name; (default: None - specified
178-
either here or in a config)
179-
-u USER, --user USER user associated to experiment's unique name; (default:
180-
$USER - can be overriden either here or in a config)
181-
-c path-to-config, --config path-to-config
182-
user provided orion configuration file
183-
--max-trials # number of trials to be completed for the experiment.
184-
This value will be saved within the experiment
185-
configuration and reused across all workers to
186-
determine experiment's completion. (default: inf/until
187-
preempted)
188-
--worker-trials # number of trials to be completed for this worker. If
189-
the experiment is completed, the worker will die even
190-
if it did not reach its maximum number of trials
191-
(default: inf/until preempted)
192-
--working-dir WORKING_DIR
193-
Set working directory for running experiment.
194-
--pool-size # number of simultaneous trials the algorithm should
195-
suggest. This is useful if many workers are executed
196-
in parallel and the algorithm has a strategy to sample
197-
non-independant trials simultaneously. Otherwise, it
198-
is better to leave `pool_size` to 1 and set a Strategy
199-
for Oríon's producer. Note that this option is not usefull useless you
200-
know the algorithm have a strategy to produce multiple trials
201-
simultaneously. If you have any doubt, leave it to 1.
202-
(default: 1)
203-
204-
``name``
205-
206-
The unique name of the experiment.
207-
208-
``user``
209-
210-
Username used to identify the experiments of a user. The default value is the system's username
211-
$USER.
212-
213-
``config``
214-
215-
Configuration file for Oríon which may define the database, the algorithm and all options of the
216-
command hunt, including ``name``, ``pool-size`` and ``max-trials``.
217-
218-
``max-trials``
219-
220-
The maximum number of trials tried during an experiment.
221-
222-
``worker-trials``
223-
224-
The maximum number of trials to be executed by a worker (a single call to ``orion hunt [...]``).
225-
226-
``working-dir``
227-
228-
The directory where configuration files are created. If not specified, Oríon will create a
229-
temporary directory that will be removed at end of execution of the trial.
230-
231-
``pool-size``
232-
233-
The number of trials which are generated by the algorithm each time it is interrogated. This is
234-
useful if many workers are executed in parallel and the algorithm has a strategy to sample
235-
non-independant trials simultaneously. Otherwise, it is better to leave ``pool_size`` to its default
236-
value 1. Note that this option is not usefull useless you know the algorithm have a strategy
237-
to produce multiple trials simultaneously. If you have any doubt, leave it to 1. :)

docs/src/user/config.rst

Lines changed: 36 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -97,14 +97,14 @@ Full Example of Global Configuration
9797
seed: None
9898
max_broken: 3
9999
max_trials: 1000000000
100-
pool_size: 1
101100
strategy:
102101
MaxParallelStrategy
103102
worker_trials: 1000000000
104103
working_dir:
105104
106105
worker:
107106
n_workers: 1
107+
pool_size: 0
108108
executor: joblib
109109
executor_configuration: {}
110110
heartbeat: 120
@@ -211,7 +211,6 @@ Experiment
211211
seed: None
212212
max_broken: 3
213213
max_trials: 1000000000
214-
pool_size: 1
215214
strategy:
216215
MaxParallelStrategy
217216
worker_trials: 1000000000
@@ -322,22 +321,6 @@ working_dir
322321

323322

324323

325-
.. _config_experiment_pool_size:
326-
327-
pool_size
328-
~~~~~~~~~
329-
330-
.. warning::
331-
332-
**DEPRECATED.** This argument will be removed in v0.3.
333-
334-
:Type: int
335-
:Default: 1
336-
:Env var:
337-
:Description:
338-
(DEPRECATED) This argument will be removed in v0.3.
339-
340-
341324
.. _config_experiment_algorithms:
342325

343326
algorithms
@@ -376,6 +359,7 @@ Worker
376359
377360
worker:
378361
n_workers: 1
362+
pool_size: 0
379363
executor: joblib
380364
executor_configuration: {}
381365
heartbeat: 120
@@ -400,6 +384,20 @@ n_workers
400384
It is possible to run many `orion hunt` in parallel, and each will spawn
401385
``n_workers``.
402386

387+
.. _config_worker_pool_size:
388+
389+
pool_size
390+
~~~~~~~~~
391+
392+
:Type: int
393+
:Default: 0
394+
:Env var:
395+
:Description:
396+
Number of trials to sample at a time. If 0, default to number of workers.
397+
Increase it to improve the sampling speed if workers spend too much time
398+
waiting for algorithms to sample points. An algorithm will try sampling `pool_size`
399+
trials but may return less.
400+
403401

404402
.. _config_worker_executor:
405403

@@ -520,6 +518,7 @@ Experiment Version Control
520518
.. code-block:: yaml
521519
522520
evc:
521+
enable: False
523522
algorithm_change: False
524523
auto_resolution: True
525524
cli_change_type: break
@@ -531,6 +530,25 @@ Experiment Version Control
531530
non_monitored_arguments: []
532531
533532
533+
.. _config_evc_enable:
534+
535+
enable
536+
~~~~~~~~~~~~~~~
537+
538+
.. note::
539+
540+
New in version v0.1.16. Previously the EVC was always enabled. It is now disable by default
541+
and can be enabled using this option.
542+
543+
:Type: bool
544+
:Default: False
545+
:Env var: ORION_EVC_ENABLE
546+
:Description:
547+
Enable the Experiment Version Control. Defaults to False. When disabled, running
548+
an experiment different from an earlier one but sharing the same name will have the
549+
effect of overwriting the previous one in the database. Trials of the previous experiment
550+
will still point to the experiment but may be incoherent with the new search space.
551+
534552

535553
.. _config_evc_auto_resolution:
536554

docs/src/user/evc.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ could pre-train on all prior data resulting in a much more efficient optimizatio
1010
advantage of the EVC system is that it provides a systematic way to organize research and the
1111
possibility to go back in time and compare the evolution of performance throughout your research.
1212

13-
Experiments inside the EVC are organized by version. By default, every time an experiment has
13+
Experiments inside the EVC are organized by version. When enabled (See :ref:`config_evc_enable`),
14+
every time an experiment has
1415
changed but has not been explicitly renamed, its version number will automatically increment and
1516
this new version will appear as a new branch for that experiment.
1617

src/orion/algo/space.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -787,6 +787,8 @@ def get_prior_string(self):
787787

788788
args = [prior]
789789

790+
if self._shape is not None:
791+
args += ["shape={}".format(self._shape)]
790792
if self.default_value is not self.NO_DEFAULT_VALUE:
791793
args += ["default_value={}".format(repr(self.default_value))]
792794

src/orion/algo/tpe.py

Lines changed: 56 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,7 @@ def sample_one_dimension(
412412

413413
def _sample_real_dimension(self, dimension, shape_size, below_points, above_points):
414414
"""Sample values for real dimension"""
415-
if dimension.prior_name in ["uniform", "reciprocal"]:
415+
if any(map(dimension.prior_name.endswith, ["uniform", "reciprocal"])):
416416
return self.sample_one_dimension(
417417
dimension,
418418
shape_size,
@@ -421,7 +421,9 @@ def _sample_real_dimension(self, dimension, shape_size, below_points, above_poin
421421
self._sample_real_point,
422422
)
423423
else:
424-
raise NotImplementedError()
424+
raise NotImplementedError(
425+
f"Prior {dimension.prior_name} is not supported for real values"
426+
)
425427

426428
def _sample_loguniform_real_point(self, dimension, below_points, above_points):
427429
"""Sample one value for real dimension in a loguniform way"""
@@ -555,10 +557,31 @@ class GMMSampler:
555557
weights: list
556558
Weights for each Gaussian components in the GMM
557559
Default: ``None``
560+
base_attempts: int, optional
561+
Base number of attempts to sample points within `low` and `high` bounds.
562+
Defaults to 10.
563+
attempts_factor: int, optional
564+
If sampling always falls out of bound try again with `attempts` * `attempts_factor`.
565+
Defaults to 10.
566+
max_attempts: int, optional
567+
If sampling always falls out of bound try again with `attempts` * `attempts_factor`
568+
up to `max_attempts` (inclusive).
569+
Defaults to 10000.
558570
559571
"""
560572

561-
def __init__(self, tpe, mus, sigmas, low, high, weights=None):
573+
def __init__(
574+
self,
575+
tpe,
576+
mus,
577+
sigmas,
578+
low,
579+
high,
580+
weights=None,
581+
base_attempts=10,
582+
attempts_factor=10,
583+
max_attempts=10000,
584+
):
562585
self.tpe = tpe
563586

564587
self.mus = mus
@@ -567,6 +590,10 @@ def __init__(self, tpe, mus, sigmas, low, high, weights=None):
567590
self.high = high
568591
self.weights = weights if weights is not None else len(mus) * [1.0 / len(mus)]
569592

593+
self.base_attempts = base_attempts
594+
self.attempts_factor = attempts_factor
595+
self.max_attempts = max_attempts
596+
570597
self.pdfs = []
571598
self._build_mixture()
572599

@@ -575,24 +602,38 @@ def _build_mixture(self):
575602
for mu, sigma in zip(self.mus, self.sigmas):
576603
self.pdfs.append(norm(mu, sigma))
577604

578-
def sample(self, num=1, attempts=10):
605+
def sample(self, num=1, attempts=None):
579606
"""Sample required number of points"""
607+
if attempts is None:
608+
attempts = self.base_attempts
609+
580610
point = []
581611
for _ in range(num):
582612
pdf = numpy.argmax(self.tpe.rng.multinomial(1, self.weights))
583-
new_points = list(
584-
self.pdfs[pdf].rvs(size=attempts, random_state=self.tpe.rng)
585-
)
586-
while True:
587-
if not new_points:
588-
raise RuntimeError(
589-
f"Failed to sample in interval ({self.low}, {self.high})"
590-
)
591-
pt = new_points.pop(0)
592-
if self.low <= pt <= self.high:
593-
point.append(pt)
613+
attempts_tried = 0
614+
while attempts_tried < attempts:
615+
new_points = self.pdfs[pdf].rvs(
616+
size=attempts, random_state=self.tpe.rng
617+
)
618+
valid_points = (self.low <= new_points) * (self.high >= new_points)
619+
620+
if any(valid_points):
621+
index = numpy.argmax(valid_points)
622+
point.append(float(new_points[index]))
594623
break
595624

625+
index = None
626+
attempts_tried += 1
627+
628+
if index is None and attempts >= self.max_attempts:
629+
raise RuntimeError(
630+
f"Failed to sample in interval ({self.low}, {self.high})"
631+
)
632+
elif index is None:
633+
point.append(
634+
self.sample(num=1, attempts=attempts * self.attempts_factor)[0]
635+
)
636+
596637
return point
597638

598639
def get_loglikelis(self, points):

0 commit comments

Comments
 (0)