All Downloads are FREE. Search and download functionalities are using the official Maven repository.

fregata.metrics.classification.Accuracy.scala Maven / Gradle / Ivy

The newest version!
package fregata.metrics.classification

import fregata.Num
/**
 * Created by takun on 16/6/1.
 */
object Accuracy {

  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) =>
        sum += compute(p,y)
        size += 1
    }
    sum / size
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy