pub struct RegularizedEvolution {
pub population_size: usize,
pub tournament_size: usize,
/* private fields */
}Expand description
Regularized (aging) evolution NAS searcher.
Uses a cyclic population with tournament selection and single-step mutation.
Fields§
§population_size: usizeTarget population size.
tournament_size: usizeNumber of random members sampled per tournament.
Implementations§
Source§impl RegularizedEvolution
impl RegularizedEvolution
Sourcepub fn new(
space: ArchSearchSpace,
population_size: usize,
tournament_size: usize,
seed: u64,
) -> TrainResult<Self>
pub fn new( space: ArchSearchSpace, population_size: usize, tournament_size: usize, seed: u64, ) -> TrainResult<Self>
Create a new regularized evolution searcher.
§Arguments
space- Architecture search space.population_size- Target size of the cyclic population (≥ 2).tournament_size- Number of randomly drawn population members per tournament (≤ population_size).seed- RNG seed for reproducibility.
§Errors
Returns TrainError::InvalidParameter when:
population_size< 2tournament_size== 0 ortournament_size>population_size
Sourcepub fn ask(&mut self) -> TrainResult<Architecture>
pub fn ask(&mut self) -> TrainResult<Architecture>
Ask for the next architecture to evaluate.
- While the population has fewer than
population_sizemembers (warm-up phase), returns a freshly sampled random architecture. - Once the population is full, performs tournament selection among
tournament_sizerandomly chosen members and returns the winner mutated by one step.
Sourcepub fn tell(&mut self, arch: Architecture, score: f64)
pub fn tell(&mut self, arch: Architecture, score: f64)
Tell the result of evaluating an architecture.
Appends (arch, score) to the full history and pushes it into the
population (at the back / newest position). When the population exceeds
population_size, the oldest entry (front) is evicted.
Sourcepub fn best(&self) -> Option<&(Architecture, f64)>
pub fn best(&self) -> Option<&(Architecture, f64)>
Return a reference to the highest-scored (architecture, score) pair
currently in the population, or None if the population is empty.
Auto Trait Implementations§
impl Freeze for RegularizedEvolution
impl RefUnwindSafe for RegularizedEvolution
impl Send for RegularizedEvolution
impl Sync for RegularizedEvolution
impl Unpin for RegularizedEvolution
impl UnsafeUnpin for RegularizedEvolution
impl UnwindSafe for RegularizedEvolution
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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