Advertisement
Guest User

Untitled

a guest
Apr 20th, 2014
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1. glmnGrid <- expand.grid(alpha = c(0, .1, .2, .4, .6, .8, 1),
  2. lambda = seq(.01, .2, length = 40))
  3.  
  4. ctrl <- trainControl(method = "cv",
  5. number = 10,
  6. summaryFunction = twoClassSummary,
  7. classProbs = TRUE,
  8. index = list(TrainSet = pre2008),
  9. savePredictions = TRUE)
  10.  
  11. glmnFit <- train(x = training[,fullSet],
  12. y = training$Class,
  13. method = "glmnet",
  14. tuneGrid = glmnGrid,
  15. preProc = c("center", "scale"),
  16. metric = "ROC",
  17. trControl = ctrl)
  18.  
  19. glmnetCM <- confusionMatrix(glmnFit, norm = "none")
  20.  
  21. Reference
  22. Prediction successful unsuccessful
  23. successful 507 208
  24. unsuccessful 63 779
  25.  
  26. > dim(training)
  27. [1] 8190 1785
  28. > length(pre2008)
  29. [1] 6633
  30. > 8190-6633
  31. [1] 1557
  32.  
  33. ctrl <- trainControl(method = "LGOCV",
  34. summaryFunction = twoClassSummary,
  35. classProbs = TRUE,
  36. index = list(TrainSet = pre2008))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement