pub struct TPEOptimizer { /* private fields */ }Expand description
TPE-based hyperparameter optimizer with resume capability
Implementations§
Source§impl TPEOptimizer
impl TPEOptimizer
Sourcepub fn new(space: HyperparameterSpace) -> Self
pub fn new(space: HyperparameterSpace) -> Self
Create new TPE optimizer
Sourcepub fn optimize_parallel(
&mut self,
n_trials: usize,
episodes_per_trial: usize,
html_samples: Vec<(String, String)>,
base_config: &Config,
n_workers: usize,
) -> Result<()>
pub fn optimize_parallel( &mut self, n_trials: usize, episodes_per_trial: usize, html_samples: Vec<(String, String)>, base_config: &Config, n_workers: usize, ) -> Result<()>
Run parallel hyperparameter optimization
Sourcepub fn with_resume(
space: HyperparameterSpace,
state_path: PathBuf,
) -> Result<Self>
pub fn with_resume( space: HyperparameterSpace, state_path: PathBuf, ) -> Result<Self>
Create optimizer with resume capability
Sourcepub fn random_suggest(&self, rng: &mut impl RngExt) -> Hyperparameters
pub fn random_suggest(&self, rng: &mut impl RngExt) -> Hyperparameters
Random hyperparameter suggestion for initial trials
Sourcepub fn tell(&mut self, trial: TrialResult)
pub fn tell(&mut self, trial: TrialResult)
Record trial result and save state
Sourcepub fn get_best(&self) -> Option<&Hyperparameters>
pub fn get_best(&self) -> Option<&Hyperparameters>
Get best hyperparameters
Sourcepub fn num_trials(&self) -> usize
pub fn num_trials(&self) -> usize
Get number of trials completed
Sourcepub fn save_results_for_algorithm(
&self,
output_dir: &Path,
algorithm: AlgorithmType,
) -> Result<()>
pub fn save_results_for_algorithm( &self, output_dir: &Path, algorithm: AlgorithmType, ) -> Result<()>
Save results with algorithm-specific filename
Sourcepub fn save_results(&self, path: &Path) -> Result<()>
pub fn save_results(&self, path: &Path) -> Result<()>
Save optimization results
Auto Trait Implementations§
impl Freeze for TPEOptimizer
impl RefUnwindSafe for TPEOptimizer
impl Send for TPEOptimizer
impl Sync for TPEOptimizer
impl Unpin for TPEOptimizer
impl UnsafeUnpin for TPEOptimizer
impl UnwindSafe for TPEOptimizer
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more