pub fn cv_fdata<F, P>(
data: &FdMatrix,
y: &[f64],
fit_fn: F,
predict_fn: P,
n_folds: usize,
nrep: usize,
cv_type: CvType,
stratified: bool,
seed: u64,
) -> CvFdataResultExpand description
Generic k-fold + repeated cross-validation framework (R’s cv.fdata).
The user provides fit/predict closures so this works with any model.
§Arguments
data— Functional data matrix (n × m)y— Response vector (length n); for classification, should be 0, 1, 2, …fit_fn— Closure that fits a model on training data and returns a boxed modelpredict_fn— Closure that predicts from a model on test datan_folds— Number of CV foldsnrep— Number of repetitions (1 = single CV, >1 = repeated)cv_type— Whether this is regression or classificationstratified— Whether to stratify foldsseed— Random seed for fold assignment