[英]gamSpline Caret package
How to choose the optimal df(degrees of freedom) for my splines.如何为我的样条选择最佳 df(自由度)。 I use poisson regression and splines that helps me to adjust for non linear changes.
我使用泊松回归和样条曲线来帮助我调整非线性变化。 Using the caret package, train function with method = gamSpline the function test only 3 df.
使用 caret 包,使用 method = gamSpline 训练函数,该函数测试仅 3 df。
model <- train(
RBC ~ elapsed,
obgyn_aleph,
method = "gamSpline",
trControl = trainControl(
method = "cv",
number = 10,
verboseIter = TRUE
)
)
Aggregating results Selecting tuning parameters Fitting df = 3 on full training set聚合结果 选择调整参数 在完整训练集上拟合 df = 3
Is it the default?它是默认的吗? if so how I can change it?
如果是这样,我该如何改变它?
Tnx, Daniel Tnx,丹尼尔
The tuneGrid argument allows the user to specify a custom grid of tuning parameters, in this case, df
tuneGrid 参数允许用户指定调整参数的自定义网格,在本例中为
df
model <- train(
RBC ~ elapsed,
obgyn_aleph,
method = "gamSpline",
trControl = trainControl(
method = "cv",
number = 10,
verboseIter = TRUE
),
tuneGrid = data.frame(df=seq(2,20,by=2))
)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.