LinearModelL1CV: Linear Model with L1 regularization using cross validation

Description Usage Arguments Value Examples

Description

This algorithm splits the data into several folds and apply LinealModelL1penalites to each fold

Usage

1
2
3
LinearModelL1CV(X.mat, y.vec, fold.vec = sample(rep(1:n.folds, l =
  length(y.vec))), n.folds = 5L, penalty.vec = seq(0.5, 0, length.out =
  100), step.size = 0.01)

Arguments

X.mat

a numeric feature matrix of size n x p

y.vec

a numeric labe vector of length nrow(X.mat)

fold.vec

a numeric vector of lenght nrow(X.mat)

n.folds

a positive integer indicate number of folds, default is 5L

penalty.vec

a non-negative numeric decreasing penalty vector, default is seq(0.5, 0, length.out = 100)

step.size

a positive numeric value, default is 0.01

Value

a list with bunch of information, mean.validation.loss.vec, mean.train.loss.vec, penalty.vec, selected.penalty, weight.vec, predict function

Examples

1
2
3
4
5
6
7
library(LinearModelL1)
data(prostate, package = "ElemStatLearn")
prostate <- list(features = as.matrix(prostate[, 1:8]), labels = prostate$lpsa, is.01 = FALSE)
data.set <- prostate
X.mat <- data.set$features
y.vec <- data.set$labels
LinearModelL1CV(X.mat, y.vec)

SixianZhang/CS499-Coding-Project-4 documentation built on June 1, 2019, 4:58 a.m.