pub struct RandomSampler { /* private fields */ }Expand description
Random search: sample uniformly from each dimension.
Implementations§
Trait Implementations§
Source§impl Sampler for RandomSampler
impl Sampler for RandomSampler
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.
Source§fn n_trials(&self) -> Option<usize>
fn n_trials(&self) -> Option<usize>
Total number of trials this sampler will produce (if known).
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.Auto Trait Implementations§
impl Freeze for RandomSampler
impl RefUnwindSafe for RandomSampler
impl Send for RandomSampler
impl Sync for RandomSampler
impl Unpin for RandomSampler
impl UnsafeUnpin for RandomSampler
impl UnwindSafe for RandomSampler
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