-
Notifications
You must be signed in to change notification settings - Fork 67
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a leave-group-out resampling method #23
Comments
topepo
added a commit
that referenced
this issue
Oct 6, 2017
There are a bunch of tests that now pass (tibbles!). Please test and/or evaluate to give feedback. Here example is: > set.seed(3527)
> test_data <- data.frame(id = sort(sample(1:20, size = 80, replace = TRUE)))
> test_data$dat <- runif(nrow(test_data))
>
> set.seed(5144)
> split_by_id <- group_vfold_cv(test_data, group = "id")
>
> get_id_left_out <- function(x)
+ unique(assessment(x)$id)
>
> library(purrr)
> table(map_int(split_by_id$splits, get_id_left_out))
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
>
> set.seed(5144)
> split_by_some_id <- group_vfold_cv(test_data, group = "id", v = 7)
> held_out <- map(split_by_some_id$splits, get_id_left_out)
> table(unlist(held_out))
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
> # number held out per resample:
> map_int(held_out, length)
1 2 3 4 5 6 7
3 3 3 3 3 3 2 |
This issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with a reprex https://reprex.tidyverse.org) and link to this issue. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Similar to
caret
'sgroupKFold
.The text was updated successfully, but these errors were encountered: