pub struct SearchSpace<P: ParamKey = GenericParam> { /* private fields */ }Expand description
Type-safe search space for hyperparameters.
§Example
use aprender::automl::{SearchSpace, LogScale};
use aprender::automl::params::RandomForestParam as RF;
let space = SearchSpace::new()
.add(RF::NEstimators, 10..500)
.add(RF::MaxDepth, 2..20);
assert_eq!(space.len(), 2);Implementations§
Source§impl<P: ParamKey> SearchSpace<P>
impl<P: ParamKey> SearchSpace<P>
Sourcepub fn add_continuous(self, key: P, low: f64, high: f64) -> Self
pub fn add_continuous(self, key: P, low: f64, high: f64) -> Self
Add a continuous parameter from a float range.
Sourcepub fn add_log_scale(self, key: P, log_scale: LogScale) -> Self
pub fn add_log_scale(self, key: P, log_scale: LogScale) -> Self
Add a log-scale continuous parameter.
Sourcepub fn add_categorical<I, V>(self, key: P, choices: I) -> Self
pub fn add_categorical<I, V>(self, key: P, choices: I) -> Self
Add a categorical parameter from string choices.
Sourcepub fn add_param(self, key: P, param: HyperParam) -> Self
pub fn add_param(self, key: P, param: HyperParam) -> Self
Add a raw HyperParam.
Sourcepub fn get(&self, key: &P) -> Option<&HyperParam>
pub fn get(&self, key: &P) -> Option<&HyperParam>
Get parameter definition by key.
Sourcepub fn iter(&self) -> impl Iterator<Item = (&P, &HyperParam)>
pub fn iter(&self) -> impl Iterator<Item = (&P, &HyperParam)>
Iterate over parameter definitions.
Trait Implementations§
Source§impl<P: Clone + ParamKey> Clone for SearchSpace<P>
impl<P: Clone + ParamKey> Clone for SearchSpace<P>
Source§fn clone(&self) -> SearchSpace<P>
fn clone(&self) -> SearchSpace<P>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl<P> Freeze for SearchSpace<P>
impl<P> RefUnwindSafe for SearchSpace<P>where
P: RefUnwindSafe,
impl<P> Send for SearchSpace<P>where
P: Send,
impl<P> Sync for SearchSpace<P>where
P: Sync,
impl<P> Unpin for SearchSpace<P>where
P: Unpin,
impl<P> UnwindSafe for SearchSpace<P>where
P: UnwindSafe,
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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