gelnet.cv: k-fold cross-validation for parameter tuning.

Description Usage Arguments Details Value See Also

View source: R/gelnet.R

Description

Performs k-fold cross-validation to select the best pair of the L1- and L2-norm penalty values.

Usage

1
2
3
4
gelnet.cv(X, y, nL1, nL2, nFolds = 5, a = rep(1, n), d = rep(1, p),
  P = diag(p), m = rep(0, p), max.iter = 100, eps = 1e-05,
  w.init = rep(0, p), b.init = 0, fix.bias = FALSE, silent = FALSE,
  balanced = FALSE)

Arguments

X

n-by-p matrix of n samples in p dimensions

y

n-by-1 vector of response values. Must be numeric vector for regression, factor with 2 levels for binary classification, or NULL for a one-class task.

nL1

number of values to consider for the L1-norm penalty

nL2

number of values to consider for the L2-norm penalty

nFolds

number of cross-validation folds (default:5)

a

n-by-1 vector of sample weights (regression only)

d

p-by-1 vector of feature weights

P

p-by-p feature association penalty matrix

m

p-by-1 vector of translation coefficients

max.iter

maximum number of iterations

eps

convergence precision

w.init

initial parameter estimate for the weights

b.init

initial parameter estimate for the bias term

fix.bias

set to TRUE to prevent the bias term from being updated (regression only) (default: FALSE)

silent

set to TRUE to suppress run-time output to stdout (default: FALSE)

balanced

boolean specifying whether the balanced model is being trained (binary classification only) (default: FALSE)

Details

Cross-validation is performed on a grid of parameter values. The user specifies the number of values to consider for both the L1- and the L2-norm penalties. The L1 grid values are equally spaced on [0, L1s], where L1s is the smallest meaningful value of the L1-norm penalty (i.e., where all the model weights are just barely zero). The L2 grid values are on a logarithmic scale centered on 1.

Value

A list with the following elements:

l1

the best value of the L1-norm penalty

l2

the best value of the L2-norm penalty

w

p-by-1 vector of p model weights associated with the best (l1,l2) pair.

b

scalar, bias term for the linear model associated with the best (l1,l2) pair. (omitted for one-class models)

perf

performance value associated with the best model. (Likelihood of data for one-class, AUC for binary classification, and -RMSE for regression)

See Also

gelnet


gelnet documentation built on May 2, 2019, 2:10 p.m.