帮助在堆栈中定位候选人的函数。接受数据堆栈或模型堆栈和候选名称,并返回将候选/成员名称映射到其超参数的 tibble(如果是模型堆栈,则还映射到其堆栈系数)。
用法
collect_parameters(stack, candidates, ...)
# S3 method for default
collect_parameters(stack, candidates, ...)
# S3 method for data_stack
collect_parameters(stack, candidates, ...)
# S3 method for model_stack
collect_parameters(stack, candidates, ...)
参数
- stack
-
data_stack
或model_stack
对象。 - candidates
-
要收集参数的候选人的姓名。这将是提供给
add_candidates()
的name
参数,或者(如果未提供)提供给add_candidates()
中的candidates
参数的对象名称。 - ...
-
附加参数。目前被忽略。
值
tibble::tbl_df 包含有关成员名称和超参数的信息。
示例数据
该软件包提供了一些重采样对象和数据集,用于源自对 1212 个red-eyed 树蛙胚胎的研究的示例和小插图!
如果 Red-eyed 树蛙 (RETF) 胚胎检测到潜在的捕食者威胁,它们的孵化时间可能会比正常情况下的 7 天更早。研究人员想要确定这些树蛙胚胎如何以及何时能够检测到来自环境的刺激。为此,他们通过用钝探针摇动胚胎,对不同发育阶段的胚胎进行"predator stimulus"测试。尽管一些胚胎事先接受了庆大霉素处理,庆大霉素是一种可以消除侧线(感觉器官)的化合物。研究员朱莉·荣格(Julie Jung)和她的团队发现,这些因子决定了胚胎是否过早孵化!
请注意,stacks 包中包含的数据不一定是完整数据集的代表性或无偏差子集,并且仅用于演示目的。
reg_folds
和 class_folds
是来自 rsample
的 rset
交叉验证对象,分别将训练数据分为回归模型对象和分类模型对象。 tree_frogs_reg_test
和tree_frogs_class_test
是类似的测试集。
reg_res_lr
、reg_res_svm
和 reg_res_sp
分别包含线性回归、支持向量机和样条模型的回归调整结果,拟合 latency
(即胚胎响应抖动需要多长时间孵化)在 tree_frogs
数据中,使用大多数其他变量作为预测变量。请注意,这些模型背后的数据经过过滤,仅包含来自响应刺激而孵化的胚胎的数据。
class_res_rf
和 class_res_nn
分别包含随机森林和神经网络分类模型的多类分类调整结果,使用大多数其他变量作为预测变量在数据中拟合 reflex
(耳朵函数的度量)。
log_res_rf
和 log_res_nn
分别包含随机森林和神经网络分类模型的二元分类调整结果,使用大多数其他变量拟合 hatched
(无论胚胎是否响应刺激而孵化)预测因子。
请参阅?example_data
了解有关这些对象的更多信息,并浏览生成它们的源代码。
例子
# see the "Example Data" section above for
# clarification on the objects used in these examples!
# put together a data stack using
# tuning results for regression models
reg_st <-
stacks() %>%
add_candidates(reg_res_lr) %>%
add_candidates(reg_res_svm) %>%
add_candidates(reg_res_sp, "spline")
reg_st
#> # A data stack with 3 model definitions and 16 candidate members:
#> # reg_res_lr: 1 model configuration
#> # reg_res_svm: 5 model configurations
#> # spline: 10 model configurations
#> # Outcome: latency (numeric)
# check out the hyperparameters for some of the candidates
collect_parameters(reg_st, "reg_res_svm")
#> # A tibble: 5 × 3
#> member cost rbf_sigma
#> <chr> <dbl> <dbl>
#> 1 reg_res_svm_1_1 3.09 0.000000465
#> 2 reg_res_svm_1_2 9.56 0.00346
#> 3 reg_res_svm_1_3 0.321 0.0256
#> 4 reg_res_svm_1_4 0.00486 0.00000251
#> 5 reg_res_svm_1_5 0.0146 0.00000000959
collect_parameters(reg_st, "spline")
#> # A tibble: 10 × 2
#> member age
#> <chr> <int>
#> 1 spline_01_1 12
#> 2 spline_02_1 6
#> 3 spline_03_1 15
#> 4 spline_04_1 5
#> 5 spline_05_1 3
#> 6 spline_06_1 13
#> 7 spline_07_1 9
#> 8 spline_08_1 10
#> 9 spline_09_1 7
#> 10 spline_10_1 2
# blend the data stack to view the hyperparameters
# along with the stacking coefficients!
collect_parameters(
reg_st %>% blend_predictions(),
"spline"
)
#> # A tibble: 10 × 3
#> member age coef
#> <chr> <int> <dbl>
#> 1 spline_01_1 12 0
#> 2 spline_02_1 6 0
#> 3 spline_03_1 15 0.486
#> 4 spline_04_1 5 0
#> 5 spline_05_1 3 0
#> 6 spline_06_1 13 0
#> 7 spline_07_1 9 0
#> 8 spline_08_1 10 0
#> 9 spline_09_1 7 0
#> 10 spline_10_1 2 0.0482
相关用法
- R stacks axe_model_stack 砍掉 model_stack。
- R stacks predict.model_stack 使用模型堆栈进行预测
- R stacks add_candidates 将模型定义添加到数据堆栈
- R stacks fit_members 拟合具有非零堆叠系数的模型堆叠成员
- R stacks blend_predictions 从数据堆栈中确定堆栈系数
- R stlmethods STL 对象的方法
- R medpolish 矩阵的中值波兰(稳健双向分解)
- R naprint 调整缺失值
- R summary.nls 总结非线性最小二乘模型拟合
- R summary.manova 多元方差分析的汇总方法
- R formula 模型公式
- R nls.control 控制 nls 中的迭代
- R aggregate 计算数据子集的汇总统计
- R deriv 简单表达式的符号和算法导数
- R kruskal.test Kruskal-Wallis 秩和检验
- R quade.test 四方测试
- R decompose 移动平均线的经典季节性分解
- R profile-methods stats4 包中的函数配置文件方法
- R plot.stepfun 绘制阶跃函数
- R alias 查找模型中的别名(依赖项)
- R qqnorm 分位数-分位数图
- R update-methods stats4包中函数更新的方法
- R eff.aovlist 多层方差分析的计算效率
- R pairwise.t.test 成对 t 检验
- R loglin 拟合对数线性模型
注:本文由纯净天空筛选整理自Max Kuhn等大神的英文原创作品 Collect candidate parameters and stacking coefficients。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。