pub struct BayesianOptimizer<F>{ /* private fields */ }Expand description
Sequential Bayesian optimization over a box.
- Sample
n_initialrandom points, evaluate, take the best. - Fit a GP to all evaluations.
- For each iteration: score
n_candidatesrandom points by Expected Improvement, evaluate the argmax, refit, repeat.
Implementations§
Source§impl<F> BayesianOptimizer<F>
impl<F> BayesianOptimizer<F>
Sourcepub const fn new(fitness: F, seed: u64) -> Self
pub const fn new(fitness: F, seed: u64) -> Self
Create an optimizer over the fitness function with a PRNG seed.
Sourcepub fn optimize(
&mut self,
bounds: &[(f64, f64)],
n_initial: usize,
n_iterations: usize,
n_candidates: usize,
exploration: f64,
) -> Result<OptimizeResult, String>
pub fn optimize( &mut self, bounds: &[(f64, f64)], n_initial: usize, n_iterations: usize, n_candidates: usize, exploration: f64, ) -> Result<OptimizeResult, String>
Run the optimization.
bounds: [(min, max), ...] per dimension (all required).
Returns the full trace and the best (params, fitness).
Auto Trait Implementations§
impl<F> Freeze for BayesianOptimizer<F>where
F: Freeze,
impl<F> RefUnwindSafe for BayesianOptimizer<F>where
F: RefUnwindSafe,
impl<F> Send for BayesianOptimizer<F>where
F: Send,
impl<F> Sync for BayesianOptimizer<F>where
F: Sync,
impl<F> Unpin for BayesianOptimizer<F>where
F: Unpin,
impl<F> UnsafeUnpin for BayesianOptimizer<F>where
F: UnsafeUnpin,
impl<F> UnwindSafe for BayesianOptimizer<F>where
F: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more