cv.ramsvm: Cross-Validation for ramsvm

Description Usage Arguments Value Examples

View source: R/ramsvm.R

Description

Perform cross-validation for the optimal lambda of ramsvm.

Usage

1
2
3
4
cv.ramsvm(x = NULL, y, gamma = 0.5, valid_x = NULL, valid_y = NULL, nfolds = 10,
	 lambda_seq = 2^{seq(-10, 15, length.out = 100)},
	 kernel = c("linear", "gaussian"), kparam = 1, 
	 scale = FALSE, criterion = c("0-1", "loss"), optModel = FALSE, nCores = 1, ...)

Arguments

x

A n x p data matrix, where n is the number of observations and p is the number of variables.

y

A response vector with three and more labels.

gamma

The convex combination parameter of the loss function.

valid_x

A validation data matrix for selecting lambda and threshold parameter v (optional). If valid_x=NULL, nfolds-fold cross-validation is performed.

valid_y

A validation response vector (optional).

nfolds

The number of folds for cross-validation.

lambda_seq

A sequence of regularization parameter to control a level of l_2-penalty.

kernel

A character string representing one of type of kernel.

kparam

A parameter needed for kernel.

scale

A logical value indicating whether to scale the variables. If scale=TRUE, x is scaled to zero mean and unit variance.

criterion

A type of criterion evaluating prediction performance of cross-validation.

optModel

A logical. Whether to obtain the optimal classification model.

nCores

The number of cores to use for parallel computing.

...

Other arguments that can be passed to ramsvm function.

Value

An S3 object of class "ramsvm" containing the following slots

opt_param

The optimal lambda and kernel parameter.

opt_valid_err

A minimum value of cross-validation errors.

opt_ind

An index of optimal lambda.

valid_err

Cross-validation errors.

nfolds

The number of folds for cross-validation.

opt_model

If optModel=TRUE, classification model with the optimal lambda is returned.

call

The call of cv.ramsvm.

Examples

1

bbeomjin/GBFSMSVM documentation built on Nov. 7, 2021, 10:20 p.m.