Skip to content

Commit

Permalink
lasso regression
Browse files Browse the repository at this point in the history
  • Loading branch information
gtesei committed Dec 22, 2015
1 parent 1f8a4a7 commit c93a60e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion R-package/R/fastRegression.R
Original file line number Diff line number Diff line change
Expand Up @@ -391,9 +391,16 @@ ff.trainAndPredict.reg = function(Ytrain ,
tuneGrid = ridgeGrid,
trControl = controlObject, ...)
pred = as.numeric( predict(model , Xtest ) )
} else if (model.label == "ridge") { ### Ridge_Reg
ridgeGrid <- data.frame(.lambda = seq(0, .1, length = 15))
model <- caret::train(y = Ytrain, x = Xtrain ,
method = "lasso",
tuneLength = 10,
trControl = controlObject, ...)
pred = as.numeric( predict(model , Xtest ) )
} else if (model.label == "enet") { ### Enet_Reg
enetGrid <- expand.grid(.lambda = c(0, 0.01, .1), .fraction = seq(.05, 1, length = 20))
if (best.tuning) enetGrid <- expand.grid(.lambda = c(0, 0.01,.1,.5,.8), .fraction = seq(.05, 1, length = 30))
if (best.tuning) enetGrid <- expand.grid(.lambda = c(0, 0.01,.1,.5,.8 , 1), .fraction = seq(0, 1, length = 30))
model <- caret::train(y = Ytrain, x = Xtrain ,
method = "enet",
tuneGrid = enetGrid,
Expand Down
Binary file modified fastfurious-manual.pdf
Binary file not shown.

0 comments on commit c93a60e

Please sign in to comment.