Skip to content

Results

optimize() and result() return a Result:

Field Meaning
best_fitness, best_params The best individual found in the whole run
generations One GenerationStats per generation: the evaluations used so far, its best fitness and parameters, worst fitness, mean, median and standard deviation
evaluations, failures How many evaluations were made, and how many of them failed
reached_threshold Whether the run stopped early because it reached threshold
stopped Whether the run was stopped before it finished, by its callback or Ctrl+C
run How the result was produced: the optimizer, its full config including the seed, the search space, any initial points, the objective's name, workers and timeout, the versions of hone, Python and numpy, and when the run started and how long it took

A result can be saved to JSON and loaded back:

result.save("run.json")
result = Result.load("run.json")

rebuild_optimizer() sets up a new optimizer exactly as the result's was, so a saved run can be repeated. Run it on the same objective and it returns the same result; for CMA-ES and Bayesian optimization, also use the same number of workers, result.run.workers. An optimizer class of your own is rebuilt with rebuild_optimizer(MyOptimizer).

optimizer = Result.load("run.json").rebuild_optimizer()

Two results are equal when they found the same things: the same best point, generations and evaluations. Their run records aren't compared, since a repeated run starts at a different time.