-
Notifications
You must be signed in to change notification settings - Fork 63
Labels
enhancementNew feature or requestNew feature or request
Description
The quick start example in the documentation is shown below:
from deephyper.hpo import HpProblem, CBO
from deephyper.analysis.hpo import parameters_at_max
from deephyper.evaluator import Evaluator
def run(job):
x = job.parameters["x"]
b = job.parameters["b"]
function = job.parameters["function"]
if function == "linear":
y = x + b
elif function == "cubic":
y = x**3 + b
return y
def optimize():
problem = HpProblem()
problem.add_hyperparameter((-10.0, 10.0), "x")
problem.add_hyperparameter((0, 10), "b")
problem.add_hyperparameter(["linear", "cubic"], "function")
evaluator = Evaluator.create(run, method="process",
method_kwargs={
"num_workers": 2,
},
)
search = CBO(problem, evaluator, random_state=42)
results = search.search(max_evals=100)
return results
if __name__ == "__main__":
results = optimize()
print(results)
res = parameters_at_max(results)
print("\nOptimum values")
print("function:", res[0]["function"])
print("x:", res[0]["x"])
print("b:", res[0]["b"])
print("y:", res[1])Running this example creates a context.yaml file. The purpose of this file is to summarize the optimization problem that was performed along with search and evaluator parameters among other things. This content should be logged to the screen or printed to a text file by the logger. There is no need to use YAML for this. Also, by replacing this functionality with logging features, it may be possible to remove the pyyaml dependency since it is not used elsewhere in the deephyper package.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request