Skip to content
This repository has been archived by the owner on Sep 18, 2024. It is now read-only.

Add GP Tuner and related doc #1191

Merged
merged 26 commits into from
Jun 25, 2019
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
6099fb4
fix link err in docs
suiguoxin May 28, 2019
44cf69c
add spaces
suiguoxin May 28, 2019
3f87626
re-organise links for detailed descriptions of the tuners and accesso…
suiguoxin May 28, 2019
b92c4ab
add in-page link by change .md to .html
suiguoxin May 29, 2019
3be8892
Merge branch 'master' of git://github.com/microsoft/nni
suiguoxin May 29, 2019
0717988
delete #section from cross-file links to make links work in both read…
suiguoxin May 29, 2019
db20820
Merge branch 'master' of git://github.com/microsoft/nni
suiguoxin Jun 5, 2019
21725f9
gp_tuner init from fmfn's repo
suiguoxin Jun 20, 2019
e35fa2b
fix params bug by adding float>int transition
suiguoxin Jun 20, 2019
17be796
add optimal choices; support randint&quniform type; add doc
suiguoxin Jun 21, 2019
3906b34
refine doc and code
suiguoxin Jun 21, 2019
b776d7e
change mnist yml comments
suiguoxin Jun 21, 2019
dbac6ed
typo fix
suiguoxin Jun 21, 2019
df3952a
fix val err
suiguoxin Jun 23, 2019
37f4b12
fix minimize mode err
suiguoxin Jun 23, 2019
56a1575
add config test and Hpo result
suiguoxin Jun 23, 2019
ba8dccd
Merge branch 'master' of https://github.com/microsoft/nni
suiguoxin Jun 23, 2019
8cd50e3
support quniform type; update doc; update test config
suiguoxin Jun 24, 2019
942f519
update doc
suiguoxin Jun 24, 2019
ce4906f
un-commit changed in yarn.lock
suiguoxin Jun 24, 2019
a0d6cd1
fix optimize mode bug
suiguoxin Jun 25, 2019
10df680
optimize mode
suiguoxin Jun 25, 2019
c5f3da0
optimize mode
suiguoxin Jun 25, 2019
77c9547
reset pylint, gitignore
suiguoxin Jun 25, 2019
d6febf2
Merge branch 'master' of git://github.com/microsoft/nni
suiguoxin Jun 25, 2019
66ba114
revert .gitignore yarn.lock
suiguoxin Jun 25, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 43 additions & 1 deletion docs/en_US/BuiltinTuner.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Currently we support the following algorithms:
|[__Network Morphism__](#NetworkMorphism)|Network Morphism provides functions to automatically search for architecture of deep learning models. Every child network inherits the knowledge from its parent network and morphs into diverse types of networks, including changes of depth, width, and skip-connection. Next, it estimates the value of a child network using the historic architecture and metric pairs. Then it selects the most promising one to train. [Reference Paper](https://arxiv.org/abs/1806.10282)|
|[__Metis Tuner__](#MetisTuner)|Metis offers the following benefits when it comes to tuning parameters: While most tools only predict the optimal configuration, Metis gives you two outputs: (a) current prediction of optimal configuration, and (b) suggestion for the next trial. No more guesswork. While most tools assume training datasets do not have noisy data, Metis actually tells you if you need to re-sample a particular hyper-parameter. [Reference Paper](https://www.microsoft.com/en-us/research/publication/metis-robustly-tuning-tail-latencies-cloud-systems/)|
|[__BOHB__](#BOHB)|BOHB is a follow-up work of Hyperband. It targets the weakness of Hyperband that new configurations are generated randomly without leveraging finished trials. For the name BOHB, HB means Hyperband, BO means Byesian Optimization. BOHB leverages finished trials by building multiple TPE models, a proportion of new configurations are generated through these models. [Reference Paper](https://arxiv.org/abs/1807.01774)|
Copy link
Contributor

@xuehui1991 xuehui1991 Jun 23, 2019

Choose a reason for hiding this comment

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

please book a meeting to review your code.

Also could you give some experiment result in HPO.md, so that we could compare with other Tuner~


|[__GP Tuner__](#GPTuner)|Gaussian Process Tuner is a sequential model-based optimization (SMBO) approach with Gaussian Process as the surrogate. [Reference Paper, ](https://papers.nips.cc/paper/4443-algorithms-for-hyper-parameter-optimization.pdf)[Github Repo](https://github.com/fmfn/BayesianOptimization)|
<br>

## Usage of Builtin Tuners
Expand Down Expand Up @@ -366,3 +366,45 @@ advisor:
max_budget: 27
eta: 3
```
<br>

<a name="GPTuner"></a>

![](https://placehold.it/15/1589F0/000000?text=+) `GP Tuner`

> Builtin Tuner Name: **GPTuner**

Note that the only acceptable types of search space are `choice`, `quniform`, `uniform` and `randint`.
Copy link
Contributor

Choose a reason for hiding this comment

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

why cannot support other type?

Copy link
Member Author

Choose a reason for hiding this comment

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

loguniform, qloguniform added. Types like normal are not supported here since a limited bound is needed.


**Suggested scenario**

GP Tuner is uses a proxy optimization problem (finding the maximum of the acquisition function) that, albeit still a hard problem, is cheaper (in the computational sense) and common tools can be employed. Therefore GP Tuner is most adequate for situations where sampling the function to be optimized is a very expensive endeavor. GP Tuner has a computationoal cost that grows at *O(N^3)* due to the requirement of inverting the Gram matrix. [Detailed Description](./GPTuner.md)
Copy link
Contributor

Choose a reason for hiding this comment

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

"Therefore GP Tuner is most adequate for situations where sampling the function to be optimized is a very expensive endeavor", can you explain more?

Copy link
Member Author

Choose a reason for hiding this comment

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

Explanation added.


**Requirement of classArg**

* **optimize_mode** (*'maximize' or 'minimize', optional, default = 'maximize'*) - If 'maximize', the tuner will target to maximize metrics. If 'minimize', the tuner will target to minimize metrics.
* **utility** (*'ei', 'ucb' or 'poi', optional, default = 'ei'*) - The kind of utility function. 'ei', 'ucb' and 'poi' corresponds to 'Expected Improvement', 'Upper Confidence Bound' and 'Probability of Improvement' respectively.
Copy link
Contributor

Choose a reason for hiding this comment

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

how to select these choice?

Copy link
Member Author

Choose a reason for hiding this comment

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

There is no fixed rule for choosing utility function since the block-box function to be optimized varies. Normally 'ei' is good choice who balances exploration and exploitation well. I think it interesting to expose theses choices to users who are interested in the tuning algorithm.

* **kappa** (*float, optional, default = 5*) - Used by utility function 'ucb'. The bigger `kappa` is, the more the tuner will be exploratory.
Copy link
Contributor

Choose a reason for hiding this comment

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

I think part of them are optional classArg(if they have default value)...

Copy link
Member Author

Choose a reason for hiding this comment

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

All of them are optimal. Normally no need to change them except for "optimize_mode" .

* **xi** (*float, optional, default = 0*) - Used by utility function 'ei' and 'poi'. The bigger `xi` is, the more the tuner will be exploratory.
* **nu** (*float, optional, default = 2.5*) - Used to specify Matern kernel. The smaller nu, the less smooth the approximated function is.
* **alpha** (*float, optional, default = 1e-6*) - Used to specify Gaussian Process Regressor. Larger values correspond to increased noise level in the observations.
* **cold_start_num** (*int, optional, default = 10*) - Number of random exploration to perform before Gaussian Process. Random exploration can help by diversifying the exploration space.
* **selection_num_warm_up** (*int, optional, default = 1e5*) - Number of random points to evaluate for getting the point which maximizes the acquisition function.
* **selection_num_starting_points** (*int, optional, default = 250*) - Nnumber of times to run L-BFGS-B from a random starting point after the warmup.

**Usage example**

```yaml
# config.yml
tuner:
builtinTunerName: GPTuner
classArgs:
optimize_mode: maximize
kappa: 5
xi: 0
nu: 2.5
alpha: 1e-6
cold_start_num: 10
selection_num_warm_up: 1e5
selection_num_starting_points: 250
```
1 change: 1 addition & 0 deletions docs/en_US/CommunitySharings/HpoComparision.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ The total search space is 1,204,224, we set the number of maximum trial to 1000.
| HyperBand |0.414065|0.415222|0.417628|
| HyperBand |0.416807|0.417549|0.418828|
| HyperBand |0.415550|0.415977|0.417186|
| GP |0.414353|0.418563|0.420263|
Copy link
Contributor

Choose a reason for hiding this comment

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

seems that there's many hyper-params in GP tuner, pls consider adding experiments for them.

Copy link
Contributor

Choose a reason for hiding this comment

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

Also please put three times result here.

Copy link
Member Author

Choose a reason for hiding this comment

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

Conf with full hyper-parameter are added in test-config.
Two more times results are added.


For Metis, there are about 300 trials because it runs slowly due to its high time complexity O(n^3) in Gaussian Process.

Expand Down
10 changes: 10 additions & 0 deletions docs/en_US/GPTuner.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
GP Tuner on NNI
===

## GP Tuner

Bayesian optimization works by constructing a posterior distribution of functions (Gaussian Process here) that best describes the function you want to optimize. As the number of observations grows, the posterior distribution improves, and the algorithm becomes more certain of which regions in parameter space are worth exploring and which are not.

GP Tuner is designed to minimize/maximize the number of steps required to find a combination of parameters that are close to the optimal combination. To do so, this method uses a proxy optimization problem (finding the maximum of the acquisition function) that, albeit still a hard problem, is cheaper (in the computational sense) and common tools can be employed. Therefore Bayesian Optimization is most adequate for situations where sampling the function to be optimized is a very expensive endeavor.
Copy link
Contributor

Choose a reason for hiding this comment

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

Any reference paper?

Copy link
Member Author

Choose a reason for hiding this comment

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

paper link added


Note that the only acceptable types of search space are `choice`, `quniform`, `uniform` and `randint`.
1 change: 1 addition & 0 deletions docs/en_US/SearchSpaceSpec.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ All types of sampling strategies and their parameter are listed here:
| Grid Search Tuner | &#10003; | | | &#10003; | | &#10003; | | | | |
| Hyperband Advisor | &#10003; | &#10003; | &#10003; | &#10003; | &#10003; | &#10003; | &#10003; | &#10003; | &#10003; | &#10003; |
| Metis Tuner | &#10003; | &#10003; | &#10003; | &#10003; | | | | | | |
| GP Tuner | &#10003; | &#10003; | &#10003; | &#10003; | | | | | | |


Known Limitations:
Expand Down
2 changes: 1 addition & 1 deletion examples/trials/auto-gbdt/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ searchSpacePath: search_space.json
#choice: true, false
useAnnotation: false
tuner:
#choice: TPE, Random, Anneal, Evolution, BatchTuner, MetisTuner
#choice: TPE, Random, Anneal, Evolution, BatchTuner, MetisTuner, GPTuner
#SMAC (SMAC should be installed through nnictl)
builtinTunerName: TPE
classArgs:
Expand Down
2 changes: 1 addition & 1 deletion examples/trials/auto-gbdt/config_metis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ searchSpacePath: search_space_metis.json
#choice: true, false
useAnnotation: false
tuner:
#choice: TPE, Random, Anneal, Evolution, BatchTuner, MetisTuner
#choice: TPE, Random, Anneal, Evolution, BatchTuner, MetisTuner, GPTuner
#SMAC (SMAC should be installed through nnictl)
builtinTunerName: MetisTuner
classArgs:
Expand Down
2 changes: 1 addition & 1 deletion examples/trials/auto-gbdt/config_pai.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ searchSpacePath: search_space.json
#choice: true, false
useAnnotation: false
tuner:
#choice: TPE, Random, Anneal, Evolution, BatchTuner, MetisTuner
#choice: TPE, Random, Anneal, Evolution, BatchTuner, MetisTuner, GPTuner
#SMAC (SMAC should be installed through nnictl)
builtinTunerName: TPE
classArgs:
Expand Down
2 changes: 1 addition & 1 deletion examples/trials/mnist/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ searchSpacePath: search_space.json
#choice: true, false
useAnnotation: false
tuner:
#choice: TPE, Random, Anneal, Evolution, BatchTuner, MetisTuner
#choice: TPE, Random, Anneal, Evolution, BatchTuner, MetisTuner, GPTuner
#SMAC (SMAC should be installed through nnictl)
builtinTunerName: TPE
classArgs:
Expand Down
2 changes: 1 addition & 1 deletion examples/trials/mnist/config_assessor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ searchSpacePath: search_space.json
#choice: true, false
useAnnotation: false
tuner:
#choice: TPE, Random, Anneal, Evolution, BatchTuner, MetisTuner
#choice: TPE, Random, Anneal, Evolution, BatchTuner, MetisTuner, GPTuner
#SMAC (SMAC should be installed through nnictl)
builtinTunerName: TPE
classArgs:
Expand Down
2 changes: 1 addition & 1 deletion examples/trials/mnist/config_frameworkcontroller.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ searchSpacePath: search_space.json
#choice: true, false
useAnnotation: false
tuner:
#choice: TPE, Random, Anneal, Evolution, BatchTuner, MetisTuner
#choice: TPE, Random, Anneal, Evolution, BatchTuner, MetisTuner, GPTuner
builtinTunerName: TPE
classArgs:
#choice: maximize, minimize
Expand Down
2 changes: 1 addition & 1 deletion examples/trials/mnist/config_kubeflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ searchSpacePath: search_space.json
#choice: true, false
useAnnotation: false
tuner:
#choice: TPE, Random, Anneal, Evolution, BatchTuner, MetisTuner
#choice: TPE, Random, Anneal, Evolution, BatchTuner, MetisTuner, GPTuner
builtinTunerName: TPE
classArgs:
#choice: maximize, minimize
Expand Down
2 changes: 1 addition & 1 deletion examples/trials/mnist/config_pai.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ searchSpacePath: search_space.json
#choice: true, false
useAnnotation: false
tuner:
#choice: TPE, Random, Anneal, Evolution, BatchTuner, MetisTuner
#choice: TPE, Random, Anneal, Evolution, BatchTuner, MetisTuner, GPTuner
#SMAC (SMAC should be installed through nnictl)
builtinTunerName: TPE
classArgs:
Expand Down
2 changes: 1 addition & 1 deletion examples/trials/mnist/config_windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ searchSpacePath: search_space.json
#choice: true, false
useAnnotation: false
tuner:
#choice: TPE, Random, Anneal, Evolution, BatchTuner, MetisTuner
#choice: TPE, Random, Anneal, Evolution, BatchTuner, MetisTuner, GPTuner
#SMAC (SMAC should be installed through nnictl)
builtinTunerName: TPE
classArgs:
Expand Down
3 changes: 2 additions & 1 deletion pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ max-attributes=15
const-naming-style=any

disable=duplicate-code,
super-init-not-called
super-init-not-called,
cell-var-from-loop
Copy link
Contributor

Choose a reason for hiding this comment

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

any particular reason to add this rule?

Copy link
Member Author

Choose a reason for hiding this comment

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

Just to silent a pylint warning "cell variable define in loop". The warning is not reasonable. The code which got this warning is in sdk/pynni/nni/gu_tuner/util.py, line 41

Copy link
Contributor

Choose a reason for hiding this comment

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

If you really want to get rid of this warning, pls add comments to disable it. Not here in pylint.


# List of members which are set dynamically and missed by pylint inference
generated-members=numpy.*,torch.*
2 changes: 1 addition & 1 deletion src/nni_manager/rest_server/restValidationSchemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ export namespace ValidationSchemas {
checkpointDir: joi.string().allow('')
}),
tuner: joi.object({
builtinTunerName: joi.string().valid('TPE', 'Random', 'Anneal', 'Evolution', 'SMAC', 'BatchTuner', 'GridSearch', 'NetworkMorphism', 'MetisTuner'),
builtinTunerName: joi.string().valid('TPE', 'Random', 'Anneal', 'Evolution', 'SMAC', 'BatchTuner', 'GridSearch', 'NetworkMorphism', 'MetisTuner', 'GPTuner'),
codeDir: joi.string(),
classFileName: joi.string(),
className: joi.string(),
Expand Down
Loading