Skip to main content

validation_curve

Function validation_curve 

Source
pub fn validation_curve<S, F, M, P>(
    splitter: &S,
    x: &Array2<f64>,
    y: &Array1<f64>,
    fit_fn: F,
    scorer: &(dyn Scorer + Sync),
    param_range: &[P],
) -> Result<ValidationCurve<P>>
where S: CvSplitter, F: Fn(&P, &Array2<f64>, &Array1<f64>) -> M + Sync, M: Fn(&Array2<f64>) -> Array1<f64>, P: Clone + Sync,
Expand description

Compute a validation curve: for each hyperparameter value and each fold, fit with that value and score on train and validation.

fit_fn here takes the parameter value as its first argument (e.g. a closure over “fit a decision tree with this max_depth”).

With the parallel feature the param × fold grid is fanned out over rayon.

§Errors

Propagates any error from splitter.split(x.nrows()).