pub struct GridSearch { /* private fields */ }Expand description
Grid search strategy for hyperparameter optimization.
Exhaustively searches over a grid of hyperparameter values.
Implementations§
Source§impl GridSearch
impl GridSearch
Sourcepub fn new(
param_space: HashMap<String, HyperparamSpace>,
num_grid_points: usize,
) -> Self
pub fn new( param_space: HashMap<String, HyperparamSpace>, num_grid_points: usize, ) -> Self
Create a new grid search.
§Arguments
param_space- Hyperparameter space definitionnum_grid_points- Number of points for continuous parameters
Sourcepub fn generate_configs(&self) -> Vec<HyperparamConfig> ⓘ
pub fn generate_configs(&self) -> Vec<HyperparamConfig> ⓘ
Generate all parameter configurations for grid search.
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.
Sourcepub fn total_configs(&self) -> usize
pub fn total_configs(&self) -> usize
Get total number of configurations to evaluate.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for GridSearch
impl RefUnwindSafe for GridSearch
impl Send for GridSearch
impl Sync for GridSearch
impl Unpin for GridSearch
impl UnwindSafe for GridSearch
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