Learn R Programming

less (version 0.1.0)

k_fold_cv: k-Fold Cross Validation

Description

Applies k-Fold cross validation to the given model on the given data

Usage

k_fold_cv(
  data = NULL,
  model = NULL,
  random_state = NULL,
  k = 5,
  y_index = ncol(data)
)

Value

A vector consists of metric of the individual folds and the average metric over the folds

Arguments

data

The dataset to be used

model

A classification or a regression model (from LESS package)

random_state

A seed number to get reproducable result

k

Number of splits on the training set (defaults to 5)

y_index

Column index of the response variable on the given data. Default is the last column.

Examples

Run this code
k_fold_cv(data = iris, model = KNeighborsClassifier$new(), k = 3)

Run the code above in your browser using DataLab