Description Usage Arguments Value Examples
This algorithm splits the data into several folds and apply LinealModelL1penalites to each fold
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)
|
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 |
a list with bunch of information, mean.validation.loss.vec, mean.train.loss.vec, penalty.vec, selected.penalty, weight.vec, predict function
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.