pub struct RandomSearch { /* private fields */ }Expand description
Random search strategy for hyperparameter optimization.
Randomly samples from the hyperparameter space.
Implementations§
Source§impl RandomSearch
impl RandomSearch
Sourcepub fn new(
param_space: HashMap<String, HyperparamSpace>,
num_samples: usize,
seed: u64,
) -> Self
pub fn new( param_space: HashMap<String, HyperparamSpace>, num_samples: usize, seed: u64, ) -> Self
Create a new random search.
§Arguments
param_space- Hyperparameter space definitionnum_samples- Number of random configurations to tryseed- Random seed for reproducibility
Sourcepub fn generate_configs(&mut self) -> Vec<HyperparamConfig> ⓘ
pub fn generate_configs(&mut self) -> Vec<HyperparamConfig> ⓘ
Generate random parameter configurations.
Sourcepub fn add_result(&mut self, result: HyperparamResult)
pub fn add_result(&mut self, result: HyperparamResult)
Add a result from evaluating a configuration.
Sourcepub fn best_result(&self) -> Option<&HyperparamResult>
pub fn best_result(&self) -> Option<&HyperparamResult>
Get the best result found so far.
Sourcepub fn sorted_results(&self) -> Vec<&HyperparamResult>
pub fn sorted_results(&self) -> Vec<&HyperparamResult>
Get all results sorted by score (descending).
Sourcepub fn results(&self) -> &[HyperparamResult]
pub fn results(&self) -> &[HyperparamResult]
Get all results.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for RandomSearch
impl RefUnwindSafe for RandomSearch
impl Send for RandomSearch
impl Sync for RandomSearch
impl Unpin for RandomSearch
impl UnwindSafe for RandomSearch
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> 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