Skip to content

Commit

Permalink
Merge branch 'main' into coolheri
Browse files Browse the repository at this point in the history
  • Loading branch information
teytaud authored May 1, 2022
2 parents f33243e + 5540474 commit 00466e5
Show file tree
Hide file tree
Showing 70 changed files with 1,379 additions and 366 deletions.
18 changes: 9 additions & 9 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ orbs:
executors:
ubuntu-python37:
docker:
- image: circleci/python:3.7
- image: cimg/python:3.7
working_directory: ~/repo


Expand All @@ -27,9 +27,9 @@ commands:
- restore_cache:
name: "[all] Restore cache"
keys:
- v1-dependencies-{{ checksum "requirements/dev.txt" }}-{{ checksum "requirements/main.txt"}}-{{ checksum "requirements/bench.txt"}}
- v2-dependencies-{{ checksum "requirements/dev.txt" }}-{{ checksum "requirements/main.txt"}}-{{ checksum "requirements/bench.txt"}}
# fallback to installing main requirements
- v1-dependencies-main-{{ checksum "requirements/main.txt"}}
- v2-dependencies-main-{{ checksum "requirements/main.txt"}}

- run:
name: "[all] Install dependencies"
Expand All @@ -53,7 +53,7 @@ jobs:
- restore_cache:
name: "[no-extra] Restore cache"
keys:
- v1-dependencies-main-{{ checksum "requirements/main.txt"}}
- v2-dependencies-main-{{ checksum "requirements/main.txt"}}
# fallback to using the latest cache if no exact match is found

- run:
Expand All @@ -80,7 +80,7 @@ jobs:
name: "[no-extra] Save cache"
paths:
- ./venv
key: v1-dependencies-main-{{ checksum "requirements/main.txt"}}
key: v2-dependencies-main-{{ checksum "requirements/main.txt"}}

- run:
name: "[no-extra] Run basic tests (checking dependencies)"
Expand All @@ -95,7 +95,7 @@ jobs:
name: "[all] Save cache"
paths:
- ./venv
key: v1-dependencies-{{ checksum "requirements/dev.txt" }}-{{ checksum "requirements/main.txt"}}-{{ checksum "requirements/bench.txt"}}
key: v2-dependencies-{{ checksum "requirements/dev.txt" }}-{{ checksum "requirements/main.txt"}}-{{ checksum "requirements/bench.txt"}}

- run:
name: "[all] Print installation"
Expand Down Expand Up @@ -187,7 +187,7 @@ jobs:
command: |
. venv/bin/activate
black --version
black nevergrad --check
black nevergrad --check --diff
pytests:
Expand Down Expand Up @@ -247,7 +247,7 @@ jobs:
- restore_cache:
name: "[all] Restore cache"
keys:
- v1-win-dependencies-{{ checksum "requirements/dev.txt" }}-{{ checksum "requirements/main.txt"}}-{{ checksum "requirements/bench.txt"}}
- v2-win-dependencies-{{ checksum "requirements/dev.txt" }}-{{ checksum "requirements/main.txt"}}-{{ checksum "requirements/bench.txt"}}

- run:
name: Setup nevergrad in virtualenv
Expand All @@ -262,7 +262,7 @@ jobs:
name: "[all] Save cache"
paths:
- ./venv
key: v1-win-dependencies-{{ checksum "requirements/dev.txt" }}-{{ checksum "requirements/main.txt"}}-{{ checksum "requirements/bench.txt"}}
key: v2-win-dependencies-{{ checksum "requirements/dev.txt" }}-{{ checksum "requirements/main.txt"}}-{{ checksum "requirements/bench.txt"}}

- run:
name: "[all] Print installation"
Expand Down
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,18 @@

## main

### Breaking changes

- Removed `descriptor` field of parameters which had been deprecated in previous versions. Use `function` field instead to specify if the function
is deterministic or not [#X](https://github.com/facebookresearch/nevergrad/pull/X).

### Important changes

- `TransitionChoice` behavior has been changed to use bins instead of a full float representation. This may lead to slight
changes during optimizations. It can also be set as unordered for use with discrete 1+1 optimizers (experimental)

### Other changes

## 0.5.0 (2022-03-08)

### Breaking changes
Expand Down
6 changes: 3 additions & 3 deletions docs/machinelearning.rst
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,12 @@ Asynchronous version with concurrent.futures
from concurrent import futures
for name in names:
optim = ng.optimizers.registry[name](parametrization=parametrization, budget=budget)
optim = ng.optimizers.registry[name](parametrization=instru, budget=budget)
with futures.ThreadPoolExecutor(max_workers=optim.num_workers) as executor: # the executor will evaluate the function in multiple threads
recommendation = optim.minimize(train_and_return_test_error, executor=executor)
print("* ", name, " provides a vector of parameters with test error ",
train_and_return_test_error(recommendation))
train_and_return_test_error(*recommendation.args, **recommendation.kwargs))
Optimization of mixed (continuous and discrete) hyperparameters
Expand Down Expand Up @@ -184,7 +184,7 @@ Then you can run the optimization as usual. :code:`PortfolioDiscreteOnePlusOne`
import nevergrad as ng
budget = 1200 # How many episode we will do before concluding.
for name in ["RandomSearch", "ScrHammersleySearch", "TwoPointsDE", "PortfolioDiscreteOnePlusOne", "CMA", "PSO"]:
optim = ng.optimizers.registry[name](parametrization=parametrization, budget=budget)
optim = ng.optimizers.registry[name](parametrization=instru, budget=budget)
for u in range(budget // 3):
x1 = optim.ask()
# Ask and tell can be asynchronous.
Expand Down
4 changes: 0 additions & 4 deletions docs/opencompetition2020.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,6 @@ Make sure to select the Open Optimization Competition 2020 as track when you sub
**Submission deadline is Sept. 30, 2020, AoE**
All pull requests active between December 1st 2019 and Sept 30, 2020 are eligible.

## Awards:
Up to 12 000 euros of awards, to be used for traveling to PPSN or GECCO 2020 or 2021, distributed over several winners.
In addition, a limited number of registration fee waivers are available for PPSN 2020.

## Winners:
The winning entries of the Open Optimization Competition 2020 are
(ordered by pull request ID):
Expand Down
11 changes: 11 additions & 0 deletions docs/parametrization_ref.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ The aim of parametrization is to specify what are the parameters that the optimi
The parametrization subpackage will help you do thanks to:

- the `parameter` modules (accessed by the shortcut `nevergrad.p`) providing classes that should be used to specify each parameter.
- the `ops` module (accessed through `ng.ops`) providing experimental objects for modifying a parameter behavior (eg: casting to int, adding complex constraints).
- the `FolderFunction` which helps transform any code into a Python function in a few lines. This can be especially helpful to optimize parameters in non-Python 3.6+ code (C++, Octave, etc...) or parameters in scripts.


Expand Down Expand Up @@ -39,3 +40,13 @@ Parameter API
.. autoclass:: nevergrad.p.Parameter
:members:
:inherited-members:

Operators
---------
These experimental operators are designed to be instantiated and called with a parameter as input, creating a new parameter with the required behavior.

.. automodule:: nevergrad.ops
:members: Int



4 changes: 2 additions & 2 deletions mypy.ini
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
[mypy]

[mypy-scipy.*,requests,pandas,compiler_gym,compiler_gym.*,gym,gym.*,gym_anm,matplotlib.*,pytest,cma,bayes_opt.*,torchvision.models,torch.*,mpl_toolkits.*,fcmaes.*,tqdm,pillow,PIL,PIL.Image,sklearn.*,pyomo.*,pyproj,IOHexperimenter.*,tensorflow,koncept.models,cv2,imquality,imquality.brisque,lpips,mixsimulator.*,networkx.*,cdt.*,pymoo,pymoo.*,bayes_optim.*,olympus.*,auto-sklearn.*,openml]
[mypy-scipy.*,requests,pandas,compiler_gym,compiler_gym.*,gym_anm,,gym,gym.*,matplotlib.*,pytest,cma,bayes_opt.*,torchvision.models,torch.*,mpl_toolkits.*,fcmaes.*,tqdm,pillow,PIL,PIL.Image,sklearn.*,pyomo.*,pyproj,IOHexperimenter.*,tensorflow,koncept.models,cv2,imquality,imquality.brisque,lpips,mixsimulator.*,networkx.*,cdt.*,pymoo,pymoo.*,bayes_optim.*,olympus.*,auto-sklearn.*,openml,pymoo,pymoo.*,pybullet,pybullet_envs,pybulletgym,pyvirtualdisplay,nlopt,aquacrop.*]
ignore_missing_imports = True

[mypy-nevergrad.functions.rl.agents,torchvision,torchvision.*,nevergrad.functions.games.*,nevergrad.functions.multiobjective.pyhv,nevergrad.optimization.test_doc,,pymoo,pymoo.*,pybullet,pybullet_envs,pybulletgym,pyvirtualdisplay,nlopt,aquacrop.*]
[mypy-nevergrad.functions.rl.*,torchvision,torchvision.*,nevergrad.functions.games.*,nevergrad.functions.multiobjective.pyhv,nevergrad.optimization.test_doc,nevergrad.functions.gym.multigym]
ignore_missing_imports = True
ignore_errors = True

Expand Down
4 changes: 2 additions & 2 deletions nevergrad/benchmark/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def launch(
output: tp.Optional[tp.PathLike] = None,
) -> Path:
"""Launch experiment with given names and selection modulo
max_index can be specified to provide a limited number of settings
cap_index can be specified to provide a limited number of settings
"""
# create the data
csvpath = Path(experiment + ".csv") if output is None else Path(output)
Expand Down Expand Up @@ -103,7 +103,7 @@ def repeated_launch(
repetitions: int = 1,
) -> None:
"""Launch experiment with given names and selection module
max_index can be specified to provide a limited number of settings
cap_index can be specified to provide a limited number of settings
This repeats the plan several times and increments the seed.
"""
# start by importing additional content
Expand Down
4 changes: 2 additions & 2 deletions nevergrad/benchmark/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ def _submit_jobs(
seed: int
a seed for the experiment plan (if seedable)
executor: Executor-like object
an object such as concurrent.futures.ThreadPoolExecutor for running experiments in parallel
an object such as concurrent.futures.ProcessPoolExecutor for running experiments in parallel
print_function: tp.Callable
a function to print at the end of each experiment (for custom logging)
cap_index: int
Expand Down Expand Up @@ -281,7 +281,7 @@ def compute(
seed: int
a seed for the experiment plan (if seedable)
executor: Executor-like object
an object such as concurrent.futures.ThreadPoolExecutor for running experiments in parallel
an object such as concurrent.futures.ProcessPoolExecutor for running experiments in parallel
print_function: tp.Callable
a function to print at the end of each experiment (for custom logging)
cap_index: int
Expand Down
Loading

0 comments on commit 00466e5

Please sign in to comment.