fregata.metrics.classification.Recall.scala Maven / Gradle / Ivy
The newest version!
package fregata.metrics.classification
import fregata.Num
/**
* Created by takun on 16/6/1.
*/
object Recall {
def compute(p:Double,y:Double) = if( y == p ) 1 else 0
def of(it:Iterable[(Num,Num)]) = {
var sum = 0d
var size = 0
it.foreach{
case (p,y) =>
if (p == 1) {
sum += compute(p, y)
size += 1
}
}
sum / size
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy