LinearModelL1CV: LinearModelL1CV

Description Usage Arguments Value Examples

View source: R/LinearModelL1.R

Description

perform a cross-validation using n.folds to select the nest training set for the data, this function trains a new model for each train/test split and then selects the best weight vector for the whole data set

Usage

1
2
3
4
5
6
7
8
LinearModelL1CV(
  X.mat,
  y.vec,
  fold.vec = NULL,
  n.folds = 5,
  penalty.vec = NULL,
  step.size = 0.02
)

Arguments

X.mat

Unscaled data matrix [ n_observations : n_features ]

y.vec

a vector of labels [ n_observations : 1 ]

fold.vec

a vector that indicadeted which fold each observation belongs to [ n_observatons : 1 ]

n.folds

positive integer (default: 5)

penalty.vec

a vector of penalties to use for the CV of each fold

step.size

the incriment to step by when doing gradient descent

Value

a list of objects to evaluate how the whole model performed over all folds. 1. mean.validation.loss.vec: a vector of the mean validation loss over all the folds. 2. mean.train.loss.vec: a vector of training loss over all the folds. 3. penalty.vec: the penalty vector used in the CV. 4. selected.penalty: the best penalty to use in that vector, 5. weight.vec: the optimal weight vector for predictions 6. predict: a function that can be called like this 'result.list$predict(testX.mat)' where result list is the whole list object

Examples

1

ChaddFrasier/planetLearn documentation built on July 5, 2020, 2:32 a.m.