get_best_predictions: Get best predictions

View source: R/utility_functions.R

get_best_predictionsR Documentation

Get best predictions

Description

Returns the CV predictions associated with the best performing tuning parameters. If there are multiple CV repeats, these are separated.

Usage

get_best_predictions(trainobj, rep = NA, ncomp = NA, keepX = NA,
  keepY = NA)

Arguments

trainobj

The train object from caret, fit using mixOmics spls.

rep

If trainobj was fit using repeated cross-validation, choose a repeat (e.g. "Rep1") or leave as NA for all repeats (default).

ncomp

Manually select CV predictions with this parameter, instead of the best one from train.

keepX

Manually select CV predictions with this parameter, instead of the best one from train.

keepY

Manually select CV predictions with this parameter, instead of the best one from train.

Value

A data.frame with the variables

  • pred - the predicted values

  • obs - the observed values

  • ncomp - Tuning variable

  • keepX - Tuning variable

  • keepY - Tuning variable

  • fold - Cross-validation fold

  • rep - Repeat number (for repeated CV)

Examples

library(caret)
x <- data.frame(matrix(rnorm(1000),nrow = 100))
y <- rnorm(100)
PLS <- train(x = x, y = y, method = get_mixOmics_spls())
getBestPredictions(PLS)

jonathanth/mixOmicsCaret documentation built on Feb. 25, 2023, 5:41 a.m.