Open sgruber65 opened 3 years ago
@sgruber65 @ecpolley I have a function that (I think) does the same thing. Mine seems a lot more complex than the one above, however, it's a drop-in replacement for CVFolds()
so perhaps it can be useful? Or perhaps the SuperLearner::CVFolds()
function has been updated to support both support by ID and outcome in the meantime?
Here's my version: https://gist.github.com/ledell/bd4e227d4e5ff426c41d
@ecpolley I would be happy to make a PR if useful.
Hi. I'm sharing a little function that approximately preserves class balance within each training and validation set, even when ids are non-unique, as long as the minority class is rare (adapted from CVFolds). -- Susan stratifyCVFoldsById <- function (V, Y, id = NULL) {
1. distribute the ids that have Y = 1 in any of the rows equally among all the folds,
}