title: random forest: predict vs predict_proba
body: <p>I am working on a multiclass, highly imbalanced classification problem. I use random forest as base classifier.</p>
  <p>I would have to give report of model performance on the evaluation set considering multiple criteria (metrics: <code>precision, recall conf_matrix, roc_auc</code>).</p>
  <p>Model train:</p>
  <pre><code>rf = RandomForestClassifier(()
  rf.fit(train_X, train_y)
  </code></pre>
  <p>To obtain precision/recall and confusion_matrix, I go like:</p>
  <pre><code>pred = rf.predict(test_X)
  precision = metrics.precision_score(y_test, pred)
  recall  = metrics.recall_score(y_test, pred)
  f1_score = metrics.f1_score(y_test, pred) 
  confusion_matrix = metrics.confusion_matrix(y_test, pred)
  </code></pre>
  <p>Fine, but then computing <code>roc_auc</code> requires the prediction probability of classes and not the class labels. For that I must further do this:</p>
  <pre><code>y_prob = rf.predict_proba(test_X)
  roc_auc = metrics.roc_auc_score(y_test, y_prob)
  </code></pre>
  <p>But then I'm worried here that the outcome produced first by <code>rf.predict()</code> may not be consistent with <code>rf.predict_proba()</code> so the <code>roc_auc</code> score I'm reporting. I know that calling <code>predict</code> several times will produce exactly the same result, but I'm concern <code>predict</code> then <code>predict_proba</code> might produce slightly different results, making it inappropriate to discuss together with the metrics above.</p>
  <p>If that is the case, is there a way to control this, making sure the class probabilities used by <code>predict()</code> to decide predicted labels are exactly the same when I then call <code>predict_proab</code>?</p>