-
Notifications
You must be signed in to change notification settings - Fork 26
CurrinExp Prior
In this example we show how to use HyperMapper's prior-guided pptimization to optimize a CurrinExp function. We look for minimizing the value of this function given two parameters x1, x2.
The CurrinExp objective function can be defined as:
factor1 = 1 - math.exp(-1/(2*x2))
factor2 = 2300*x1*x1*x1 + 1900*x1*x1 + 2092*x1 + 60
factor3 = 100*x1*x1*x1 + 500*x1*x1 + 4*x1 + 20
y_value = factor1*factor2/factor3
y_energy = x1 + x2
An example of this code can be found in prior_currinexp.py.
In this example, we will inject priors into HyperMapper's optimization. Since the CurrinExp function has its optimum at X = [0, 1]
, we use decay and exponential priors for the input parameters. The json configuration file for this example is:
{
"application_name": "currinexp",
"optimization_objectives": ["Value"],
"optimization_method": "prior_guided_optimization",
"optimization_iterations": 20,
"design_of_experiment":{
"number_of_samples": 3
},
"input_parameters" : {
"x1": {
"parameter_type" : "real",
"values" : [0, 1],
"prior" : "decay"
},
"x2": {
"parameter_type" : "real",
"values" : [0.00001, 1],
"prior" : "exponential"
}
}
}
Note that we add two new fields to the json:
- We tell HyperMapper to use the prior-guided optimization method with
"optimization_method": "prior_guided_optimization"
- We tell HyperMapper the priors for the input parameters with
"prior": "decay"
and"prior": "exponential"
.
You can find this json in currinexp_scenario.json. See here for more information on how to use prior-guided optimization and the supported prior types.
Remember to add the scripts folder to your $PYTHONPATH. In order to run this example, we use:
cd $HYPERMAPPER_HOME
python3 example_scenarios/synthetic/currinexp/currinexp.py
An example of stdout output can be found here.
The result of this script is a csv file called currinexp_output_dse_samples.csv.