Displaying 1 result from an estimated 1 matches for "bestfraction".
2011 May 24
1
seeking help on using LARS package
...> dim(trainData)
[1] 18520 88
ytrain <- trainScore
length(ytrain)
[1] 18520
nfolds <- 100
epsilon <- exp(-10)
# code from JP Vert
object1 <- cv.lars(xtrain,ytrain, K=nfolds, fraction = seq(from = 0, to = 1
, length= 1000), type='lasso', eps=epsilon, plot.it=TRUE)
bestfraction <- object1$fraction[min(which(object1$cv <= min(object1$cv)+
0.01*(max(object1$cv)-min(object1$cv))))]
bestcoef <- coef(object1,s=bestfraction,mode='fraction') # this gives
bestcoef as NULL, I don't know why.
# End code from Jp Vert
# Code by me:: Not so sure about the authe...