pub struct GridSearchCV<E, F, ConfigFn>where
E: Clone + Fit<Array2<Float>, Array1<Float>, Fitted = F>,
F: Predict<Array2<Float>, Array1<Float>> + Score<Array2<Float>, Array1<Float>, Float = f64>,
ConfigFn: Fn(E, &ParameterSet) -> Result<E>,{ /* private fields */ }Expand description
Grid search cross-validation
Exhaustive search over specified parameter values for an estimator. Uses cross-validation to evaluate each parameter combination.
Implementations§
Source§impl<E, F, ConfigFn> GridSearchCV<E, F, ConfigFn>
impl<E, F, ConfigFn> GridSearchCV<E, F, ConfigFn>
Sourcepub fn new(estimator: E, param_grid: ParameterGrid, config_fn: ConfigFn) -> Self
pub fn new(estimator: E, param_grid: ParameterGrid, config_fn: ConfigFn) -> Self
Create a new grid search CV
Sourcepub fn cv<C: CrossValidator + 'static>(self, cv: C) -> Self
pub fn cv<C: CrossValidator + 'static>(self, cv: C) -> Self
Set the cross-validation strategy
Sourcepub fn best_estimator(&self) -> Option<&F>
pub fn best_estimator(&self) -> Option<&F>
Get the best estimator (after fitting)
Sourcepub fn best_params(&self) -> Option<&ParameterSet>
pub fn best_params(&self) -> Option<&ParameterSet>
Get the best parameters (after fitting)
Sourcepub fn best_score(&self) -> Option<f64>
pub fn best_score(&self) -> Option<f64>
Get the best score (after fitting)
Sourcepub fn cv_results(&self) -> Option<&GridSearchResults>
pub fn cv_results(&self) -> Option<&GridSearchResults>
Get the CV results (after fitting)
Trait Implementations§
Source§impl<E, F, ConfigFn> Fit<ArrayBase<OwnedRepr<f64>, Dim<[usize; 2]>>, ArrayBase<OwnedRepr<f64>, Dim<[usize; 1]>>> for GridSearchCV<E, F, ConfigFn>
impl<E, F, ConfigFn> Fit<ArrayBase<OwnedRepr<f64>, Dim<[usize; 2]>>, ArrayBase<OwnedRepr<f64>, Dim<[usize; 1]>>> for GridSearchCV<E, F, ConfigFn>
Source§type Fitted = GridSearchCV<E, F, ConfigFn>
type Fitted = GridSearchCV<E, F, ConfigFn>
The fitted model type
Source§fn fit(self, x: &Array2<Float>, y: &Array1<Float>) -> Result<Self::Fitted>
fn fit(self, x: &Array2<Float>, y: &Array1<Float>) -> Result<Self::Fitted>
Fit the model to the provided data with validation
Source§fn fit_with_validation(
self,
x: &X,
y: &Y,
_x_val: Option<&X>,
_y_val: Option<&Y>,
) -> Result<(Self::Fitted, FitMetrics), SklearsError>where
Self: Sized,
fn fit_with_validation(
self,
x: &X,
y: &Y,
_x_val: Option<&X>,
_y_val: Option<&Y>,
) -> Result<(Self::Fitted, FitMetrics), SklearsError>where
Self: Sized,
Fit with custom validation and early stopping
Source§impl<E, F, ConfigFn> Predict<ArrayBase<OwnedRepr<f64>, Dim<[usize; 2]>>, ArrayBase<OwnedRepr<f64>, Dim<[usize; 1]>>> for GridSearchCV<E, F, ConfigFn>
impl<E, F, ConfigFn> Predict<ArrayBase<OwnedRepr<f64>, Dim<[usize; 2]>>, ArrayBase<OwnedRepr<f64>, Dim<[usize; 1]>>> for GridSearchCV<E, F, ConfigFn>
Source§fn predict(&self, x: &Array2<Float>) -> Result<Array1<Float>>
fn predict(&self, x: &Array2<Float>) -> Result<Array1<Float>>
Make predictions on the provided data
Source§fn predict_with_uncertainty(
&self,
x: &X,
) -> Result<(Output, UncertaintyMeasure), SklearsError>
fn predict_with_uncertainty( &self, x: &X, ) -> Result<(Output, UncertaintyMeasure), SklearsError>
Make predictions with confidence intervals
Auto Trait Implementations§
impl<E, F, ConfigFn> Freeze for GridSearchCV<E, F, ConfigFn>
impl<E, F, ConfigFn> !RefUnwindSafe for GridSearchCV<E, F, ConfigFn>
impl<E, F, ConfigFn> Send for GridSearchCV<E, F, ConfigFn>
impl<E, F, ConfigFn> Sync for GridSearchCV<E, F, ConfigFn>
impl<E, F, ConfigFn> Unpin for GridSearchCV<E, F, ConfigFn>
impl<E, F, ConfigFn> !UnwindSafe for GridSearchCV<E, F, ConfigFn>
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