我在使用带有插入符号的游侠来预测概率时遇到了麻烦。这是我的代码:
model <- train(Species ~ .,
data = iris,
method = "ranger",
probability = TRUE)
这将返回以下错误,警告和消息。
## Something is wrong; all the Accuracy metric values are missing:
## Accuracy Kappa
## Min. : NA Min. : NA
## 1st Qu.: NA 1st Qu.: NA
## Median : NA Median : NA
## Mean :NaN Mean :NaN
## 3rd Qu.: NA 3rd Qu.: NA
## Max. : NA Max. : NA
## NA's :6 NA's :6
## Error: Stopping
## In addition: There were 50 or more warnings (use warnings() to see the first 50)
尽管在插入符号之外运行它。
ranger(Species ~ ., data = iris, probability = TRUE)
答案 0 :(得分:3)
将classProbs
放在trControl
内,如下所示:
model <- train(
Species ~ .
,data = iris
,method = "ranger"
,trControl = trainControl(classProbs=TRUE)
)