cv.KLR: Cross-validation on Kernel Logistic Regression

Description Usage Arguments Details Value See Also

View source: R/cv.R

Description

This function performs cross-validation to select values of tuning parameters.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
cv.KLR(
  y,
  x,
  n_folds = 5,
  kernel = c("gaussian", "polynomial")[1],
  lambda = c(1, 0.1, 0.01, 0.001),
  sigma2 = c(5, 2, 1, 0.5),
  d = 3,
  threshold = 1e-06,
  max_iter = 1e+05
)

Arguments

y

A n x 1 column vector containing the responses (0-1).

x

A n x p matrix containing the covariates.

n_folds

Number of folds in the CV.

kernel

The kernel to use. Either gaussian (default) or polynomial.

lambda

The regularization parameter(s).

sigma2

The scale(s) in the gaussian and polynomial kernel. See details.

d

The degree(s) in the polynomial kernel.

threshold

The convergence threshold.

max_iter

The maximum number of iterations.

Details

The gaussian kernel has the following form:

exp(-||x-y||^2/sigma2).

The polynomial kernel has the following form:

(1+x'y/sigma2)^d.

Value

A list containing:

mpe

The mean prediction error across all folds for all combinations of parameters.

lambda_min

The selected value of lambda.

sigma2_min

The selected value of sigma2.

d_min

The selected value of d.

See Also

KLR


fontaine618/KLR documentation built on March 29, 2021, 1:46 a.m.