幫助在堆棧中定位候選人的函數。接受數據堆棧或模型堆棧和候選名稱,並返回將候選/成員名稱映射到其超參數的 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。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。