title: Spark Java : Is optimal threshold used for calculating ROC in Spark BinaryClassificationMetrics class
body: <p>I am using Spark <code>mlib's</code> <code>BinaryClassificationMetrics</code> class to generate the metrics for the output of <code>RandomForestClassificationModel</code>. I have gone through the Spark docs and I am able to generate <code>thresholds</code>, <code>precisionByThreshold</code>, <code>recallByThreshold</code>, <code>roc</code> and <code>pr</code>.</p>
  
  <p>I wanted to know if any particular threshold value is used while generating <code>roc</code>. This is because in  <a href="https://en.wikipedia.org/wiki/Receiver_operating_characteristic" rel="nofollow noreferrer">ROC wikipedia</a> it says that: </p>
  
  <blockquote>
    <p>The ROC curve is created by plotting the true positive rate (TPR) against the false positive rate (FPR) at various threshold settings.</p>
  </blockquote>
  
  <p>I was wondering if any optimal threshold value is used or not while generating ROC in Spark. If not why?</p>