pub struct StudyBuilder<V: PartialOrd = f64> { /* private fields */ }Expand description
A builder for constructing Study instances with a fluent API.
Created via Study::builder(). Collects sampler, pruner, direction,
and storage options before constructing the study.
§Defaults
- Direction:
Minimize - Sampler:
RandomSampler - Pruner:
NopPruner - Storage:
MemoryStorage
§Examples
use optimizer::prelude::*;
let study: Study<f64> = Study::builder()
.maximize()
.sampler(TpeSampler::new())
.pruner(MedianPruner::new(Direction::Maximize).n_warmup_steps(5))
.build();
assert_eq!(study.direction(), Direction::Maximize);Implementations§
Source§impl<V: PartialOrd> StudyBuilder<V>
impl<V: PartialOrd> StudyBuilder<V>
Sourcepub fn direction(self, direction: Direction) -> Self
pub fn direction(self, direction: Direction) -> Self
Set the optimization direction explicitly.
Sourcepub fn sampler(self, sampler: impl Sampler + 'static) -> Self
pub fn sampler(self, sampler: impl Sampler + 'static) -> Self
Set the sampler used for parameter suggestions.
Defaults to RandomSampler if not specified.
Sourcepub fn pruner(self, pruner: impl Pruner + 'static) -> Self
pub fn pruner(self, pruner: impl Pruner + 'static) -> Self
Set the pruner used for early stopping of trials.
Defaults to NopPruner (no pruning) if not specified.
Sourcepub fn storage(self, storage: impl Storage<V> + 'static) -> Self
pub fn storage(self, storage: impl Storage<V> + 'static) -> Self
Set a custom storage backend.
Defaults to MemoryStorage if not specified.
Auto Trait Implementations§
impl<V> Freeze for StudyBuilder<V>
impl<V = f64> !RefUnwindSafe for StudyBuilder<V>
impl<V> Send for StudyBuilder<V>where
V: Send,
impl<V> Sync for StudyBuilder<V>where
V: Sync,
impl<V> Unpin for StudyBuilder<V>where
V: Unpin,
impl<V = f64> !UnwindSafe for StudyBuilder<V>
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