mixle.doe.multifidelity module¶
Cost-aware multi-fidelity Bayesian optimization.
Many expensive objectives have lower-fidelity approximations – a coarser mesh, fewer Monte-Carlo samples, a shorter training run. Multi-fidelity BO exploits them: it spends low-cost low-fidelity evaluations to locate good regions and reserves the expensive high-fidelity ones for refinement, reaching the optimum of the true (target) objective for a fraction of the cost of optimizing it directly.
multi_fidelity_minimize() follows the BOCA idea (Kandasamy et al. 2017): a single GP over the
input augmented with a fidelity coordinate learns how fidelities correlate; each step picks the input by
Expected Improvement at the target fidelity, then picks the fidelity that buys the most target-variance
reduction per unit cost. It fits the torch GP surrogate.
- multi_fidelity_minimize(objective, bounds, *, fidelities=(0.5, 1.0), costs=None, target=None, n_init=None, max_cost=40.0, n_candidates=256, maximize=False, seed=None, fit_kwargs=None)[source]
Cost-aware multi-fidelity Bayesian optimization of
objective(x, s).objective(x, s)returns the response at inputxand fidelitys(one offidelities); the largest fidelity (ortarget) is the true objective.target, if given, must itself be one offidelities: this function never evaluates a fidelity outside that set, so an out-of-set target could otherwise only ever be “satisfied” by silently substituting a lower-fidelity response for it.costsis the per-fidelity evaluation cost (default: the fidelity value itself) and, if given, must supply exactly one entry per fidelity. The loop fits a GP over[x, s], proposesxby Expected Improvement at the target fidelity, then evaluates at the fidelity maximizing target-variance reduction per unit cost. Every evaluation – initial per-fidelity seeding and the sequential loop alike – reserves its cost againstmax_costbefore callingobjective, so cumulative cost never overshootsmax_cost; amax_costtoo small to afford even one evaluation is rejected up front.Returns
{'x', 'y', 'X', 'Y', 'cost', 'target_evaluated', 'stopped_reason', 'error', 'failed_evaluations'}.X/Yare the usable finite augmented evaluation history (fidelity in the last column ofX) andcostis the total actually spent, including failed calls.failed_evaluationsseparately preserves each unusable attempt’s point, fidelity, cost, status, and error.x/yare the best target-fidelity point and response, but only whentarget_evaluatedis true: if the budget ran out before any target-fidelity evaluation was affordable,x/yareNonerather than silently standing in a lower-fidelity result for the target-fidelity answer the caller asked for.stopped_reasonis"budget_exhausted"(the loop ran until no further evaluation fit inmax_cost– the normal, successful termination for this optimizer, which has no other stopping criterion) or"surrogate_fit_failed"(a well-defined numerical failure – e.g.numpy/torchlinalg.LinAlgErrorfrom a singular covariance – aborted the loop early;errorthen holds a diagnostic string, elseNone). Any other exception out of surrogate fitting (a badfit_kwargsoptimizer name, a missing torch install, …) propagates rather than being reported as a quiet early stop.