R中将正类设为1

Lau*_*gon 3 r confusion-matrix random-forest r-caret

我目前正在使用'randomForest'软件包开发预测模型.

适合我的模型如下

rf <- foreach(ntree=rep(10, 3), .combine= combine,  .packages='randomForest') %dopar% {
randomForest(bou~.,data=train, trees=50, importance=TRUE)}
Run Code Online (Sandbox Code Playgroud)

当使用'caret'包中的'confusionMatrix'时,我得到以下结果:

在此输入图像描述

我想知道是否可以在模型中将正类设置为1.我在包描述中搜索但是找不到任何关于它的信息.

非常感谢你.

编辑:我找到了.它是'caret'包中'confusionMatrix'命令的一个选项.我在错误的地方跋涉.如果需要,这是一个例子.

confusionMatrix(predicted,true_values,positive='1')
Run Code Online (Sandbox Code Playgroud)

我应该留下我的帖子还是删除它?

Lau*_*gon 6

我找到了.它是包中confusionMatrix命令的一个选项caret.我在看错了地方.这是一个例子,如果需要:

confusionMatrix(predicted,true_values,positive='1')
Run Code Online (Sandbox Code Playgroud)