【发布时间】:2021-08-11 12:49:05
【问题描述】:
我正在尝试从使用 caret 包中的 train() 确定的模型中提取 beta 值。
cv_model_pls <- train(
POD1HemoglobinCut ~ .,
data = train,
method = "pls",
family = "binomial",
trControl = trainControl(method = "cv", number = 10),
preProcess = c("zv", "center", "scale"),
tuneLength = 6
)
输出是:
> cv_model_pls
Partial Least Squares
9932 samples
7 predictor
2 classes: '[0,10)', '[10,Inf)'
Pre-processing: centered (7), scaled (7)
Resampling: Cross-Validated (10 fold)
Summary of sample sizes: 8939, 8939, 8939, 8938, 8940, 8939, ...
Resampling results across tuning parameters:
ncomp Accuracy Kappa
1 0.8569258 0.1994938
2 0.8698149 0.3215483
3 0.8707213 0.3303433
4 0.8710237 0.3335666
5 0.8710238 0.3341072
6 0.8708224 0.3330295
Accuracy was used to select the optimal model using the largest value.
The final value used for the model was ncomp = 5.
运行摘要以尝试获取 beta 值让我很兴奋:
> summary(cv_model_pls)
Data: X dimension: 9932 7
Y dimension: 9932 2
Fit method: oscorespls
Number of components considered: 5
TRAINING: % variance explained
Error in dimnames(tbl) <- list(c("X", yvarnames), paste(1:object$ncomp, :
length of 'dimnames' [1] not equal to array extent
- 如何提取优化模型(或其他模型)的 beta 值?
- 如何通过最大化灵敏度(而不是默认精度)来选择模型?
【问题讨论】:
标签: r machine-learning logistic-regression r-caret