ERS Adaptive Step
1 2 3 4 5 6 7 8 9 10 11 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | x = metal
y = as.numeric(Y)
n = length(y)
lambda2.start = seq(0.00001, 0.01, by = 0.001)
lambda2.adapt = seq(0.00001, 0.01, by = 0.001)
nfolds = 5
foldid = matrix(data = c(sample(n), rep(1:nfolds, length = n)), nrow = n, ncol = 2)
foldid = foldid[order(foldid[,1]),]
foldid = foldid[,2]
data.mod = model.matrix(~-1+.^2, data = x) #, x^2, covs)
x.sq = x^2
names(x.sq) = paste0(names(x), '^2')
data.mod = cbind(data.mod, x.sq, covs)
#names(data.mod) # = c(names(x), paste0(names(x), '^2'), names(covs))
pf = c(rep(1, ncol(data.mod)))
pf2 = c(rep(1, ncol(data.mod)))
method = 'ls'
ers.aenet(data.mod, y, lambda2.start, lambda2.adapt, nfolds, foldid, pf, pf2, method)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.