cv.grpPUlasso {PUlasso}R Documentation

Cross-validation for PUlasso

Description

Do a n-fold cross-validation for PUlasso.

Usage

cv.grpPUlasso(
  X,
  z,
  py1,
  initial_coef = NULL,
  group = 1:p,
  penalty = NULL,
  lambda = NULL,
  nlambda = 100,
  lambdaMinRatio = ifelse(N < p, 0.05, 0.005),
  maxit = ifelse(method == "CD", 1000, N * 10),
  weights = NULL,
  eps = 1e-04,
  inner_eps = 0.01,
  verbose = FALSE,
  stepSize = NULL,
  stepSizeAdjustment = NULL,
  batchSize = 1,
  updateFrequency = N,
  samplingProbabilities = NULL,
  method = c("CD", "GD", "SGD", "SVRG", "SAG"),
  nfolds = 10,
  fitInd = 1:nfolds,
  nCores = 1,
  trace = c("none", "param", "fVal", "all")
)

Arguments

X

Input matrix; each row is an observation. Can be a matrix or a sparse matrix.

z

Response vector representing whether an observation is labeled or unlabeled.

py1

True prevalence Pr(Y=1)

initial_coef

A vector representing an initial point where we start PUlasso algorithm from.

group

A vector representing grouping of the coefficients. For the least ambiguity, it is recommended if group is provided in the form of vector of consecutive ascending integers.

penalty

penalty to be applied to the model. Default is sqrt(group size) for each of the group.

lambda

A user supplied sequence of lambda values. If unspecified, the function automatically generates its own lambda sequence based on nlambda and lambdaMinRatio.

nlambda

The number of lambda values.

lambdaMinRatio

Smallest value for lambda, as a fraction of lambda.max which leads to the intercept only model.

maxit

Maximum number of iterations.

weights

observation weights. Default is 1 for each observation.

eps

Convergence threshold for the outer loop. The algorithm iterates until the maximum change in coefficients is less than eps in the outer loop.

inner_eps

Convergence threshold for the inner loop. The algorithm iterates until the maximum change in coefficients is less than eps in the inner loop.

verbose

A logical value. if TRUE, the function prints out the fitting process.

stepSize

A step size for gradient-based optimization. if NULL, a step size is taken to be stepSizeAdj/mean(Li) where Li is a Lipschitz constant for ith sample

stepSizeAdjustment

A step size adjustment. By default, adjustment is 1 for GD and SGD, 1/8 for SVRG and 1/16 for SAG.

batchSize

A batch size. Default is 1.

updateFrequency

An update frequency of full gradient for method =="SVRG"

samplingProbabilities

sampling probabilities for each of samples for stochastic gradient-based optimization. if NULL, each sample is chosen proportionally to Li.

method

Optimization method. Default is Coordinate Descent. CD for Coordinate Descent, GD for Gradient Descent, SGD for Stochastic Gradient Descent, SVRG for Stochastic Variance Reduction Gradient, SAG for Stochastic Averaging Gradient.

nfolds

Number of cross-validation folds to be created.

fitInd

A vector of indices of cross-validation models which will be fitted. Default is to fit the model for each of the cross-validation fold.

nCores

Number of threads to be used for parallel computing. If nCores=0, it is set to be (the number of processors available-1) . Default value is 1.

trace

An option for saving intermediate quantities when fitting a full dataset.

Value

cvm Mean cross-validation error

cvsd Estimate of standard error of cvm

cvcoef Coefficients for each of the fitted CV models

cvstdcoef Coefficients in a standardized scale for each of the fitted CV models

lambda The actual sequence of lambda values used.

lambda.min Value of lambda that gives minimum cvm.

lambda.1se The largest value of lambda such that the error is within 1 standard error of the minimum cvm.

PUfit A fitted PUfit object for the full data

Examples

data("simulPU")
fit<-cv.grpPUlasso(X=simulPU$X,z=simulPU$z,py1=simulPU$truePY1)

[Package PUlasso version 3.2.5 Index]