ecpolley / SuperLearner

Current version of the SuperLearner R package
272 stars 72 forks source link

Inconsistent behavior when V > nrow(X) #151

Open rdiaz02 opened 7 months ago

rdiaz02 commented 7 months ago

We can run CV.SuperLearner with innerCvControl = list(list(V = vi)) where vi >> nrow(X) without trouble (it just becomes leave-one-out). Similarly, in SuperLearner we can set cvControl = list(V = vi) where vi >> nrow(X). I think this is a great feature.

However, if in CV.SuperLearner we set cvControl = list(list(V = vi)) with vi > nrow(X) it fails at the very end. I understand why this happens, but instead of erroring at the end it could, somewhere at the top of the function:

  1. Set vi = min(vi, nrow(X))
  2. Give a warning if the control list has been modified.

And it might be appropriate to document it in the help of SuperLearner and CV.SuperLearner.

I can submit a PR if deemed appropriate.