title: RankingMetrics in Spark (Scala)
body: <p>I am trying to use spark RankingMetrics.meanAveragePrecision.
  However it seems like its not working as expected.</p>
  
  <pre><code>val t2 = (Array(0,0,0,0,1), Array(1,1,1,1,1))
  val r = sc.parallelize(Seq(t2))
  val rm = new RankingMetrics[Int](r)
  rm.meanAveragePrecision //  Double = 0.2
  rm.precisionAt(5) //  Double = 0.2
  </code></pre>
  
  <p>t2 is a tuple where the left array indicates the real values and the right array the predicted values (1 - relevant document, 0- non relevant)</p>
  
  <p>If we calculate the average precision for t2 we get : 
  (0/1 + 0/2 + 0/3 + 0/4 + 1/5 )/5 = 1/25
  But the RankingMetric returns 0.2 for MeanAveragePrecision which should be 1/25.</p>
  
  <p>Thanks.</p>