Search code examples
rrandom-forestr-caretconfusion-matrix

set positive class to 1 in R


I'm currently working on preditive models with the 'randomForest' package.

Fitting my model as follow

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

When using 'confusionMatrix' from the 'caret' package, I've got the results below :

enter image description here

I'd like to know if it's possible to set the positive class to 1 in the model. I searched in the package description but couldn't find anything about it.

Thank you very much.

Edit : I've found it. It's an option in the 'confusionMatrix' command from the 'caret' package. I was lokking at the wrong place. Here an example if needed.

confusionMatrix(predicted,true_values,positive='1')

Should I leave my post or delete it ?


Solution

  • I've found it. It's an option in the confusionMatrix command from the caret package. I was looking at the wrong place. Here an example if needed:

    confusionMatrix(predicted,true_values,positive='1')