cv_risk_mod_random_start {riskscores}R Documentation

Run Cross-Validation to Tune Lambda0 with Random Start

Description

Runs k-fold cross-validation on a grid of \lambda_0 values using random warm starts (see risk_mod_random_start. Records class accuracy and deviance for each \lambda_0. Returns an object of class "cv_risk_mod".

Usage

cv_risk_mod_random_start(
  X,
  y,
  weights = NULL,
  a = -10,
  b = 10,
  max_iters = 100,
  tol = 1e-05,
  nlambda = 25,
  lambda_min_ratio = ifelse(nrow(X) < ncol(X), 0.01, 1e-04),
  lambda0 = NULL,
  nfolds = 10,
  foldids = NULL,
  parallel = FALSE,
  seed = NULL,
  nstart = 5
)

Arguments

X

Input covariate matrix with dimension n \times p; every row is an observation.

y

Numeric vector for the (binomial) response variable.

weights

Numeric vector of length n with weights for each observation. Unless otherwise specified, default will give equal weight to each observation.

a

Integer lower bound for coefficients (default: -10).

b

Integer upper bound for coefficients (default: 10).

max_iters

Maximum number of iterations (default: 100).

tol

Tolerance for convergence (default: 1e-5).

nlambda

Number of lambda values to try (default: 25).

lambda_min_ratio

Smallest value for lambda, as a fraction of lambda_max (the smallest value for which all coefficients are zero). The default depends on the sample size (n) relative to the number of variables (p). If n > p, the default is 0.0001, close to zero. If n < p, the default is 0.01.

lambda0

Optional sequence of lambda values. By default, the function will derive the lambda0 sequence based on the data (see lambda_min_ratio).

nfolds

Number of folds, implied if foldids provided (default: 10).

foldids

Optional vector of values between 1 and nfolds.

parallel

If TRUE, parallel processing (using foreach) is implemented during cross-validation to increase efficiency (default: FALSE). User must first register parallel backend with a function such as doParallel::registerDoParallel.

seed

An integer that is used as argument by set.seed() for offsetting the random number generator. Default is to not set a particular randomization seed.

nstart

Number of different random starts to try (default: 5).


[Package riskscores version 1.1.1 Index]