我尝试在R中使用c50包。如this answer中所述,我运行了以下内容 -
> set.seed(1)
> mod <- train(Species ~ ., data = iris, method = "C5.0")
> summary(mod$finalModel)
和输出 -
Evaluation on training data (150 cases):
Trial Rules
----- ----------------
No Errors
0 4 4( 2.7%)
1 5 8( 5.3%)
2 3 6( 4.0%)
3 6 12( 8.0%)
4 4 5( 3.3%)
5 7 3( 2.0%)
6 3 8( 5.3%)
7 8 15(10.0%)
8 4 3( 2.0%)
9 5 5( 3.3%)
boost 0( 0.0%) <<
(a) (b) (c) <-classified as
---- ---- ----
50 (a): class setosa
50 (b): class versicolor
50 (c): class virginica
Attribute usage:
100.00% Petal.Length
66.67% Petal.Width
54.00% Sepal.Width
46.67% Sepal.Length
Time: 0.0 secs
我的问题是,我们如何以可存储在变量中的方式访问错误率(例如4(2.7%)
)以供将来分析?是否有任何参数或属性可以帮助我提取错误率?
答案 0 :(得分:2)
您可以使用以下方式访问它:
mod$finalModel$boostResults[1,]
这将为您提供第一行:
# Trial Size Errors Percent Data
#1 1 4 4 2.7 Training Set