@@ -7,7 +7,7 @@ NNI provides state-of-the-art tuning algorithm in builtin-tuners. NNI supports t
If you want to implement your own tuning algorithm, you can implement a customized Tuner, there are three things to do:
1. Inherit the base Tuner class
1. Implement receive_trial_result and generate_parameter function
1. Implement receive_trial_result, generate_parameter and update_search_space function
1. Configure your customized tuner in experiment YAML config file
Here is an example:
...
...
@@ -22,7 +22,7 @@ class CustomizedTuner(Tuner):
...
```
**2. Implement receive_trial_result and generate_parameter function**
**2. Implement receive_trial_result, generate_parameter and update_search_space function**
```python
fromnni.tunerimportTuner
...
...
@@ -49,6 +49,16 @@ class CustomizedTuner(Tuner):
# your code implements here.
returnyour_parameters
...
defupdate_search_space(self,search_space):
'''
Tuners are advised to support updating search space at run-time.
If a tuner can only set search space once before generating first hyper-parameters,
it should explicitly document this behaviour.
search_space: JSON object created by experiment owner
'''
# your code implements here.
...
```
`receive_trial_result` will receive the `parameter_id, parameters, value` as parameters input. Also, Tuner will receive the `value` object are exactly same value that Trial send.