pub struct KernelSelector {
pub candidates: Vec<Box<dyn Kernel>>,
pub config: KernelSelectionConfig,
}Expand description
Builder for running kernel selection over a fixed set of candidate kernels.
§Examples
ⓘ
let candidates: Vec<Box<dyn Kernel>> = vec![Box::new(RBF::new(1.0)), Box::new(Linear::new(1.0, 1.0))];
let selector = KernelSelector::new(candidates).criterion(SelectionCriterion::Bic);
let result = selector.select(&X, &y).expect("selection should succeed with valid data");Fields§
§candidates: Vec<Box<dyn Kernel>>Candidate kernels to evaluate.
config: KernelSelectionConfigSelection configuration.
Implementations§
Source§impl KernelSelector
impl KernelSelector
Sourcepub fn new(candidates: Vec<Box<dyn Kernel>>) -> Self
pub fn new(candidates: Vec<Box<dyn Kernel>>) -> Self
Create a new selector over the given candidate kernels, using default configuration (BIC criterion).
Sourcepub fn config(self, config: KernelSelectionConfig) -> Self
pub fn config(self, config: KernelSelectionConfig) -> Self
Set the full configuration at once.
Sourcepub fn criterion(self, criterion: SelectionCriterion) -> Self
pub fn criterion(self, criterion: SelectionCriterion) -> Self
Set the selection criterion.
Sourcepub fn cv_folds(self, cv_folds: usize) -> Self
pub fn cv_folds(self, cv_folds: usize) -> Self
Set the number of cross-validation folds (used only for
SelectionCriterion::Cv).
Sourcepub fn noise_variance(self, noise_variance: f64) -> Self
pub fn noise_variance(self, noise_variance: f64) -> Self
Set the initial observation noise variance.
Sourcepub fn random_state(self, random_state: Option<u64>) -> Self
pub fn random_state(self, random_state: Option<u64>) -> Self
Set the random state controlling the CV fold shuffle.
Trait Implementations§
Source§impl Clone for KernelSelector
impl Clone for KernelSelector
Auto Trait Implementations§
impl !RefUnwindSafe for KernelSelector
impl !UnwindSafe for KernelSelector
impl Freeze for KernelSelector
impl Send for KernelSelector
impl Sync for KernelSelector
impl Unpin for KernelSelector
impl UnsafeUnpin for KernelSelector
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> 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