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 input x and fidelity s (one of fidelities); the largest fidelity (or target) is the true objective. target, if given, must itself be one of fidelities: 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. costs is 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], proposes x by 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 against max_cost before calling objective, so cumulative cost never overshoots max_cost; a max_cost too small to afford even one evaluation is rejected up front.

Returns {'x', 'y', 'X', 'Y', 'cost', 'target_evaluated', 'stopped_reason', 'error', 'failed_evaluations'}. X/Y are the usable finite augmented evaluation history (fidelity in the last column of X) and cost is the total actually spent, including failed calls. failed_evaluations separately preserves each unusable attempt’s point, fidelity, cost, status, and error. x/y are the best target-fidelity point and response, but only when target_evaluated is true: if the budget ran out before any target-fidelity evaluation was affordable, x/y are None rather than silently standing in a lower-fidelity result for the target-fidelity answer the caller asked for. stopped_reason is "budget_exhausted" (the loop ran until no further evaluation fit in max_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/torch linalg.LinAlgError from a singular covariance – aborted the loop early; error then holds a diagnostic string, else None). Any other exception out of surrogate fitting (a bad fit_kwargs optimizer name, a missing torch install, …) propagates rather than being reported as a quiet early stop.

Parameters:
Return type:

dict[str, Any]