Skip to main content

HyperparameterOptimizer

Struct HyperparameterOptimizer 

Source
pub struct HyperparameterOptimizer<T: Float> { /* private fields */ }
Expand description

Hyperparameter optimizer for NAS and discovered architectures

Implementations§

Source§

impl<T: Float + Default + Clone + Send + Sync> HyperparameterOptimizer<T>

Source

pub fn new( search_space: HyperparameterSpace<T>, strategy: OptimizationStrategy, ) -> Self

Create a new hyperparameter optimizer, seeded from OS entropy.

Source

pub fn with_seed( search_space: HyperparameterSpace<T>, strategy: OptimizationStrategy, seed: u64, ) -> Self

Create a fully reproducible optimizer.

Source

pub fn suggest_configuration( &mut self, ) -> Result<HyperparameterConfiguration<T>>

Generate the next hyperparameter configuration to evaluate.

Returns an error for a strategy this module does not implement (OptimizationStrategy::ParticleSwarm, SuccessiveHalving, Hyperband, BOHB) rather than silently performing random search, and for a search space that declares no parameters at all.

The model-based strategies (Bayesian, TPE, Evolutionary) need a random initial design first. During that phase they sample from the prior and set HyperparameterOptimizer::last_strategy_used to OptimizationStrategy::Random, so the caller can see which algorithm actually produced the suggestion.

Source

pub fn last_strategy_used(&self) -> OptimizationStrategy

Which strategy produced the most recent suggestion. Differs from HyperparameterOptimizer::strategy exactly while a model-based strategy is still running its random initial design.

Source

pub fn strategy(&self) -> OptimizationStrategy

The configured strategy.

Source

pub fn grid_resolution(&self) -> usize

Number of points per continuous grid axis.

Source

pub fn set_grid_resolution(&mut self, resolution: usize)

Set the number of points per continuous grid axis.

Source

pub fn grid_size(&self) -> Option<usize>

Total number of distinct grid points, or None if the product overflows.

Source

pub fn set_acquisition_function(&mut self, acquisition: AcquisitionFunction)

Choose the acquisition function used by the Bayesian strategy.

Source

pub fn set_tpe_config(&mut self, config: TpeConfig)

Override the TPE tunables.

Source

pub fn set_surrogate_config(&mut self, config: SurrogateConfig)

Override the Bayesian surrogate tunables.

Source

pub fn set_evolution_config(&mut self, config: EvolutionConfig)

Override the evolutionary tunables.

Source

pub fn get_search_space(&self) -> &HyperparameterSpace<T>

The search space this optimizer explores.

Source

pub fn population(&self) -> &[HyperparameterConfiguration<T>]

The evolutionary population (fittest first), which is now genuinely read by OptimizationStrategy::Evolutionary rather than being write-only state.

Source

pub fn surrogate_model(&self) -> Option<&SurrogateModel<T>>

The fitted surrogate’s recorded training data, or None before the Bayesian strategy has run.

Source

pub fn record_evaluation(&mut self, evaluation: HyperparameterEvaluation<T>)

Record evaluation result

Source

pub fn should_stop_early(&self) -> bool

Check if optimization should stop early

Source

pub fn get_best_configuration(&self) -> Option<&HyperparameterConfiguration<T>>

Get the best configuration found so far

Source

pub fn get_statistics(&self) -> OptimizationStatistics<T>

Get optimization statistics

Trait Implementations§

Source§

impl<T: Debug + Float> Debug for HyperparameterOptimizer<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V