Code Example:
# BLOCKING by "userID"
task$col_roles$group = "userID"
# Remove "userID" from features
task$col_roles$feature = setdiff(task$col_roles$feature, "userID")
# STRATIFICATION (by Target Variable!)
task$col_roles$stratum = "answer_code"
# Instantiate the resampling on the task:
rsmp_scheme$instantiate(task)
Problem: Trying to combine the resampling procedures "Stratified resampling" (stratified by target) and 2) "Block resampling" (grouping by userID) (see mlr3 gallery example: https://mlr3gallery.mlr-org.com/posts/2020-03-30-stratification-blocking/) , the following error occurs:
Error: Cannot combine stratification with grouping
Background Information:
- My data set includes several repeated measurements per user (different number available repeated measurements per person) -> therefore, blocking or grouping per userID would be appropriate.
- In addition, the distribution of the target variable is very imbalanced, which is why a stratification by target would be appropriate.
Question: How can I implement both resampling methods in mlr3?
Thanks for your help! :-)