【发布时间】:2020-06-02 21:50:07
【问题描述】:
在 R 的 caret 包中建模的上下文中,summary() 和 print() 函数有什么区别?对于这个有 4 个分量 28.52% 或 21.4% 的模型,这里解释的方差到底是什么?
> summary(model)
Data: X dimension: 261 130
Y dimension: 261 1
Fit method: oscorespls
Number of components considered: 4
TRAINING: % variance explained
1 comps 2 comps 3 comps 4 comps
X 90.1526 92.91 94.86 96.10
.outcome 0.8772 17.17 23.99 28.52
对
> print(model)
Partial Least Squares
261 samples
130 predictors
No pre-processing
Resampling: Cross-Validated (5 fold, repeated 50 times)
Summary of sample sizes: 209, 209, 209, 208, 209, 209, ...
Resampling results across tuning parameters:
ncomp RMSE Rsquared MAE
1 5.408986 0.03144022 4.129525
2 5.124799 0.14263362 3.839493
3 4.976591 0.19114791 3.809596
4 4.935419 0.21415260 3.799365
5 5.054086 0.19887704 3.886382
RMSE was used to select the optimal model using the smallest value.
The final value used for the model was ncomp = 4.
【问题讨论】:
-
看看源代码。例如,如果您正在运行灵活的判别分析,那么您可以比较
caret:::print.bagFDA和caret:::summary.bagFDA以了解各自的不同之处。