Created
November 29, 2016 09:06
-
-
Save darkseed/5bea55a6d6668dd33a356a666defc472 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def sigmoid(x: Double) = 1.0 / (1.0 + math.exp(-x)) | |
def f1measure(TP: Double, TN: Double, FP: Double, FN: Double, alpha: Double = 1) = { | |
val P = precision(TP, FP) | |
val R = recall(TP, FN) | |
(2.0 * P * R) / (P + R) | |
} | |
def precision(TP: Double, FP: Double) = TP / (FP + TP) | |
def recall(TP: Double, FN: Double) = TP / (FN + TP) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment