Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGlmnet varimp fix #173
Glmnet varimp fix #173
Conversation
|
Seems good to me. For bonus points, add a testthat test that checks that the glmnet variable importances are positive, even if some coefficients are negative. |
|
I can do that but I may not be able to finish that for a couple days. @zachmayer could you clarify how I should run these tests? and tried running https://github.com/topepo/caret/tree/593fff8f27034eec290b311c63c01cb6cd763d22/release_process but running |
|
For unit tests we use testthat. Add a new file to pkg/caret/tests/testthat that starts with "test" (e.g. test-varImp.R). Here's an example test. The basic format is: context("Name of a test suite")
test_that("Name of unit test 1", {
data(iris)
expect_is(iris, 'data.frame')
})
test_that("Name of unit test 2", {
data(iris)
expect_equal(dim(iris), c(150, 5))
}) |
|
Hmm. Travis says my new test fails. After I install my branch, the tests pass for me locally. @zachmayer any clues on how to reproduce travis' tests? or maybe it's an issue related to packaging the model... in my latest commit I updated |
|
For tests that run on cran, you need to add the libraries required for testing to "Suggests" in the package DESCRIPTION (in this case glmnet would be added to Suggests). However, since you test is skipped on cran, you can just install the package with travis. Add this line to the - ./travis-tool.sh r_install glmnetThis will tell travis to install the glmnet package before testing so the test can use that package. |
|
I'm really trying to avoid new packages to the DESCRIPTION files, so please On Fri, Jun 26, 2015 at 12:00 PM, Zach Mayer notifications@github.com
|
|
Agreed. |
|
Ok. I've pushed the travis fix but it does not seem to have been effective. |
|
Hmm, I'll take a look |
|
It looks like glmnet was installed successfully, but for some reason it's not being detected when the test runs. The package is being installed into |
|
Try adding |
|
darn, that didn't work. |
|
Try adding |
|
I don't think so. |
|
ok, interesting. |
|
I had taken out the |
|
Bump. @zachmayer Currently the test is just skipped. |
|
@strongh Can you rebase against master so we can merge this? Thanks. |
Conflicts: pkg/caret/inst/models/models.RData
|
You also need to resolve merge conflicts in the |
This is slightly preferable to `x <- NULL` as it merely tells R CMD CHECK to ignore the variable (rather than creating the variable so R CMD CHECK passes). It’s a little less hacky.
For issue #177
Conflicts: pkg/caret/inst/models/models.RData
This reverts commit 512ccdb.
This is slightly preferable to `x <- NULL` as it merely tells R CMD CHECK to ignore the variable (rather than creating the variable so R CMD CHECK passes). It’s a little less hacky.
|
Ugh. maybe i'll just make a new PR. |
|
It'd be good for you to learn how to resolve merge conflicts, but it's not a big deal. Just close this PR and make a new one off the master branch. Thank you! |
Currently glmnet's
varImpreturns both positive and negative values. This is inconsistent with the other implementations, and leads to misleading results when scaled. This PR takes absolute values and also fixes a minor typo that I noticed the same file.