title: How to get Precision, Recall, Accuracy and F1 for Binary Class
body: <p>I'm building a machine learning model using Apache Spark's ML library and let's say RandomForestClassifier.</p>
  
  <p>I divide the dataset to training and test as below</p>
  
  <pre><code>(tr,test) = dataframe.randomSplit([0.8,0.2]), seed = 23)
  </code></pre>
  
  <p>apply the model</p>
  
  <pre><code>rf = RandomForestClassifier(numTrees=10,featuresCol = "features", 
  labelCol = "label")
  
  model= rf.fit(tr)
  
  prediction = model.transform(test)
  
  eval = BinaryClassificationEvaluator(rawPredictionCol="rawPrediction")
  
  eval.evaluate(prediction)
  </code></pre>
  
  <p>I'm under the impression that this gives me AUC which is not accuracy. How do I get the Precision, recall, F1 and accuracy for this model?</p>
  
  <p>My class variable is binary (0 or 1).</p>