我很好奇如何从插入符号训练模型中提取默认模型设置。在我的情况下,我使用ctree
来构建回归树。
library(caret)
library(party)
data(trees)
# case 1: use ctree directly
ctree_train_control<-ctree_control()
ct<-ctree(Volume~.,trees,control=ctree_train_control)
# case 2: use ctree train method in caret
modFitCtree<-train(Volume~.,data=trees,method='ctree')
假设我想知道ctree
中使用的testtype
训练控制参数modFitCtree
是否是&#34; Bonferroni&#34;或者是其他东西。在案例1中,我可以手动检查ctree_train_control
以查找默认设置。如果我有案例2中的插入符号模型,是否有某个字段可以提取这些模型设置?
答案 0 :(得分:1)
如果您想知道模型的拟合方式,请使用getModelInfo("ctree", regex = FALSE)[[1]]$fit
查看。在这种情况下,相关的行是:
if(any(names(theDots) == "controls")) { theDots$controls@gtctrl@mincriterionIn other words, if you don't specify anything, only
mincriterion
is changed. Note that it is intercepting thecontrols
argument so you can still pass that in and it will leave everything butmincriterion
alone.After you fit the model, you have access to whatever is saved. In this case:
> slotNames(modFitCtree$finalModel) [1] "data" "responses" "cond_distr_response" [4] "predict_response" "prediction_weights" "get_where" [7] "update" "tree" "where" [10] "weights"