pub struct GridSampler { /* private fields */ }Expand description
Exhaustive grid search over all combinations.
Uses lazy index-based generation: instead of building the full cartesian product in memory, it computes the parameter set for a given trial index on the fly. Safe for large search spaces.
Implementations§
Trait Implementations§
Source§impl Sampler for GridSampler
impl Sampler for GridSampler
Source§fn prepare(&mut self, space: &SearchSpace)
fn prepare(&mut self, space: &SearchSpace)
Called once before the trial loop with the resolved search
space. Lets samplers precompute state — e.g.
GridSampler
resolves its dimension grid here so n_trials is correct
before the first sample.Source§fn sample(
&mut self,
space: &SearchSpace,
trial_index: usize,
) -> Result<Option<HashMap<String, Value>>>
fn sample( &mut self, space: &SearchSpace, trial_index: usize, ) -> Result<Option<HashMap<String, Value>>>
Sample the next set of parameters. Returns None when exhausted.
Auto Trait Implementations§
impl Freeze for GridSampler
impl RefUnwindSafe for GridSampler
impl Send for GridSampler
impl Sync for GridSampler
impl Unpin for GridSampler
impl UnsafeUnpin for GridSampler
impl UnwindSafe for GridSampler
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