首页 > 解决方案 > mlr3 错误:无法将分层与分组相结合

问题描述

代码示例:

# 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)

问题:尝试结合重采样程序“分层重采样”(按目标分层)和 2)“块重采样”(按用户 ID 分组)(参见 mlr3 库示例:https ://mlr3gallery.mlr-org.com/posts/2020 -03-30-stratification-blocking/ ) ,出现以下错误:

Error: Cannot combine stratification with grouping

背景资料

问题:如何在 mlr3 中实现这两种重采​​样方法?

谢谢你的帮助!:-)

标签: groupingresamplingmlrmlr3

解决方案


推荐阅读