hongooi73 / glmnetUtils

Utilities for glmnet
65 stars 18 forks source link

cv.glmnet ignores nfolds arg #20

Closed hongooi73 closed 6 years ago

hongooi73 commented 6 years ago

From Hirokazu Iwasawa:

Hi,

Maybe a bug. Try:

set.seed(2018); plot(cv.glmnet(mpg ~ ., data=mtcars))
set.seed(2018); plot(cv.glmnet(mpg ~ ., data=mtcars, nfolds=5))
set.seed(2018); plot(cv.glmnet(mpg ~ ., data=mtcars, nfolds=1))

The outputs are all the same. The cv.glmnet.formula function seems not to deal with “nfolds” appropriately.

Greenwind1 commented 6 years ago

Just curious. In this case, what nfolds does cv.glmnet treat? default folds?

Thanks in advance.

hongooi73 commented 6 years ago

How glmnetUtils::cv.glmnet works is that it passes all your arguments to glmnet::cv.glmnet, which does the actual work of model fitting/CV. In this case, the nfolds arg isn't being passed down, so glmnet::cv.glmnet will use its default value which is 10.

Greenwind1 commented 5 years ago

@Hong-Revo I got it. Thanks.

Greenwind1 commented 5 years ago

@Hong-Revo

I forgot to ask. When will CRAN reflect this change?

Many thanks,

hongooi73 commented 5 years ago

@Greenwind1 it should be submitted in the new year.

hongooi73 commented 5 years ago

This should be showing up on CRAN in the next few days.