I am using Random Forest to classify my data into 2 classes.

After building the model, prediction is performed with type="prob" which throws the probability matrix which has the probability of each record belonging to each class.

My question is whether it is possible that the classifier throws equal probabilities for the two classes.

Example class1: 0.5 class2: 0.5

If abovementioned scenario is possible which class should we consider?


1 Answer 1


Suppose you're thinking of the R implementation of randomForest. Ties during prediction can occur.

The solution to this problem can be found in lines 589:593 of the source file "rf.c"

/* Break ties at random: */
 if (crit == cmax) {
 if (unif_rand() < 1.0 / ntie) jet[n] = j + 1;

..and citing from help file ?predict.randomForest: "NOTE2: Any ties are broken at random, so if this is undesirable, avoid it by using an odd number of trees (ntree) in randomForest()."

  • 2
    $\begingroup$ Note that the "odd number of trees" trick expressly assumes a binary classification problem, such as the one that OP presented. $\endgroup$
    – Sycorax
    Sep 14, 2015 at 17:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.