Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
Already on GitHub? Sign in to your account
Glmnet varimp fix #173
Closed
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
32cfa32
take absolute value of glmnet coefficients
strongh c8d451c
typo in some glmnet error messages
strongh 86fd857
add varImp testthat file, with assertions for non-negative glmnet values
strongh 7e0a584
update models rdata in package
strongh 512ccdb
install glmnet for travis testing
strongh a2e51ae
try adding library call in glmnet varImp test
strongh 15ec760
skip test if glmnet is not installed
strongh 2e1d0d6
add back in library(glmnet) with verbose option
strongh e6f7109
try loading library before skipping test
strongh b92e171
comment out library(glmnet)
strongh 3210817
Merge branch 'master' into glmnet-varimp-fix
strongh 1d6c73b
Fixed some documentation warnings/notes
zachmayer 16c8e8d
Use utils::globalVariables
zachmayer d22b151
fixed a bug in using BoxCox
topepo 63fe319
updated with new model objects and added test
topepo 1e2e7f3
changes for issue #163
topepo e48bba8
add Sparse Distance Weighted Discrimination #98
topepo 8a19033
From the rqPen package, quantile regression models rqnc and rqlasso w…
topepo 95c24ab
added bartMachine
topepo 922fb80
fixed a typo bug
topepo 6834594
updated binary model object
topepo b08705f
Merge branch 'master' into glmnet-varimp-fix
strongh f64472c
Revert "install glmnet for travis testing"
strongh 0dc1cb5
Fixed some documentation warnings/notes
zachmayer 228893b
Use utils::globalVariables
zachmayer f2672f3
updated with new model objects and added test
topepo 17b9489
add Sparse Distance Weighted Discrimination #98
topepo af0e55d
From the rqPen package, quantile regression models rqnc and rqlasso w…
topepo f63b567
added bartMachine
topepo
Jump to file or symbol
Failed to load files and symbols.
Binary file not shown.
| @@ -0,0 +1,26 @@ | ||
| +library(caret) | ||
| + | ||
| +context('Testing varImp') | ||
| + | ||
| +test_that('glmnet varImp returns non-negative values', { | ||
| + skip_on_cran() | ||
| +# library(glmnet, verbose=TRUE) | ||
| + skip_if_not_installed('glmnet') | ||
| + set.seed(1) | ||
| + dat <- SLC14_1(200) | ||
| + | ||
| + reg <- train(y ~ ., data = dat, | ||
| + method = "glmnet", | ||
| + tuneGrid = data.frame(lambda = .1, alpha = .5), | ||
| + trControl = trainControl(method = "none")) | ||
| + | ||
| + # this checks that some coefficients are negative | ||
| + coefs <- predict(reg$finalModel, s=0.1, type="coef") | ||
| + expect_less_than(0, sum(0 > coefs)) | ||
| + # now check that all elements of varImp are nonnegative, | ||
| + # in spite of negative coefficients | ||
| + vis <- varImp(reg, s=0.1, scale=F)$importance | ||
| + expect_equal(0, sum(0 > vis)) | ||
| +}) | ||
| + | ||
| + |