cross_validate_node_PLS: Cross validates Node based Partial Least Squares Regression

Description Usage Arguments Details Value

View source: R/cross_validate_node_PLS.R

Description

This functions calculates errors given a function for k-fold cross validation for each number of LVs up to a maximum number of LVs.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
cross_validate_node_PLS(
  node,
  max_n_LVs,
  k_folds = 10,
  error_function = MSE,
  n_cores = 1,
  end_node = FALSE,
  manifest = FALSE,
  connection_PLS = FALSE
)

Arguments

node

An object of the R6Class Node which is initialised and estimated at least once. The node needs to be connected to at least one target node for the Y matrices to exist.

max_n_LVs

An integer indicating the max number of LVs that are to be evaluated.

k_folds

An integer indicating the number of folds that are to be evaluated for the k-fold cross validation. It can not be higher than the number of samples.

error_function

A function handle for an error function which takes two equal size matrices and returns a single double.

Details

When the number is higher than the number of variables in the internal X matrix, the function might display unwanted behaviour.

Value

A list containing the test error and training error, both a Matrix of errors for each fold and each number of LVs. The rows indicate the fold, the columns indicate the max number of LVs.


GeertPostma/pathmodelr documentation built on Oct. 5, 2021, 4:17 p.m.