cv_klrs: Kernel ridge regression with Gaussian kernels with cross...

Description Usage Arguments Value Examples

View source: R/cvkern.R

Description

Kernel ridge regression with Gaussian kernels with cross validation to search for hyper-parameters (implemented with th eKLRS package)

Usage

1
2
3
4
5
6
7
8
cv_klrs(
  x,
  y,
  weights = NULL,
  k_folds = NULL,
  b_range = 10^(seq(-3, 3, 0.5)),
  lambda_range = 10^(seq(-3, 3, 0.5))
)

Arguments

x

the input features

y

the observed response (real valued)

weights

weights for input if doing weighted regression/classification. If set to NULL, no weights are used

k_folds

number of folds used in cross validation

b_range

the range of Gaussian kernel bandwidths for cross validation

lambda_range

the range of ridge regression penalty factor for cross validation

Value

a list that includes the best b, lambda, best predictions, best model fit

Examples

1
2
3
4
5
6
7
8
9
## Not run: 
n = 100; p = 10

x = matrix(rnorm(n*p), n, p)
y = pmax(x[,1], 0) + x[,2] + pmin(x[,3], 0) + rnorm(n)

fit = cv_klrs(x, y)

## End(Not run)

xnie/rlearner documentation built on April 11, 2021, 12:49 a.m.