powered by
Select components from cross-validation results
pls_cv_select(cv_result, metric = c("rmse", "mae", "r2"), minimise = NULL)
Selected number of components.
Result returned by pls_cross_validate().
pls_cross_validate()
Metric to optimise.
Logical; whether the metric should be minimised.
set.seed(123) X <- matrix(rnorm(60), nrow = 20) y <- X[, 1] - 0.5 * X[, 2] + rnorm(20, sd = 0.1) cv <- pls_cross_validate(X, y, ncomp = 2, folds = 3) pls_cv_select(cv, metric = "rmse")
Run the code above in your browser using DataLab