Learn R Programming

bigPLSR (version 0.7.2)

pls_cv_select: Select components from cross-validation results

Description

Select components from cross-validation results

Usage

pls_cv_select(cv_result, metric = c("rmse", "mae", "r2"), minimise = NULL)

Value

Selected number of components.

Arguments

cv_result

Result returned by pls_cross_validate().

metric

Metric to optimise.

minimise

Logical; whether the metric should be minimised.

Examples

Run this code
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