[英]Using ranger method caret train function
I am having trouble using ranger with caret to predict probabilities. 我在将游侠与插入号结合使用来预测概率时遇到了麻烦。 Here is my code:
这是我的代码:
model <- train(Species ~ .,
data = iris,
method = "ranger",
probability = TRUE)
This returns the following error(s), warning(s), and message(s). 这将返回以下错误,警告和消息。
## 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)
Running it outside of caret works though. 虽然可以在插入符号之外运行它。
ranger(Species ~ ., data = iris, probability = TRUE)
Put classProbs
inside trControl
as in: 将
classProbs
放入trControl
中,如下所示:
model <- train(
Species ~ .
,data = iris
,method = "ranger"
,trControl = trainControl(classProbs=TRUE)
)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.